From 4c9ff425ade510545542de6b74cef4ad3dc0fba1 Mon Sep 17 00:00:00 2001 From: Alina Lenk Date: Sun, 6 Mar 2022 18:13:19 +0100 Subject: [PATCH] Make alltemperate and single_pole visible to the client See osdn #44040 Signed-off-by: Alina Lenk --- client/packhand.c | 6 +++++- common/map.c | 5 +++-- common/map_types.h | 4 ++-- common/networking/packets.def | 2 ++ server/generator/mapgen.c | 2 +- server/generator/mapgen_topology.c | 6 +++--- server/generator/temperature_map.c | 2 +- server/maphand.c | 2 ++ server/settings.c | 4 ++-- 9 files changed, 21 insertions(+), 12 deletions(-) diff --git a/client/packhand.c b/client/packhand.c index 37b2df54a4..db4f14b394 100644 --- a/client/packhand.c +++ b/client/packhand.c @@ -2174,7 +2174,8 @@ void handle_set_topology(int topology_id) Receive information about the map size and topology from the server. We initialize some global variables at the same time. ****************************************************************************/ -void handle_map_info(int xsize, int ysize, int topology_id) +void handle_map_info(int xsize, int ysize, int topology_id, + bool alltemperate, bool single_pole) { int ts_topo; @@ -2186,6 +2187,9 @@ void handle_map_info(int xsize, int ysize, int topology_id) wld.map.xsize = xsize; wld.map.ysize = ysize; + wld.map.alltemperate = alltemperate; + wld.map.single_pole = single_pole; + if (tileset_map_topo_compatible(topology_id, tileset, &ts_topo) == TOPO_INCOMP_HARD) { tileset_error(LOG_NORMAL, _("Map topology (%s) and tileset (%s) incompatible."), describe_topology(topology_id), describe_topology(ts_topo)); diff --git a/common/map.c b/common/map.c index 2dba730cb5..c0603098da 100644 --- a/common/map.c +++ b/common/map.c @@ -169,6 +169,9 @@ void map_init(struct civ_map *imap, bool server_side) imap->xsize = MAP_DEFAULT_LINEAR_SIZE; imap->ysize = MAP_DEFAULT_LINEAR_SIZE; + imap->single_pole = MAP_DEFAULT_SINGLE_POLE; + imap->alltemperate = MAP_DEFAULT_ALLTEMPERATE; + if (server_side) { imap->server.mapsize = MAP_DEFAULT_MAPSIZE; imap->server.size = MAP_DEFAULT_SIZE; @@ -186,8 +189,6 @@ void map_init(struct civ_map *imap, bool server_side) imap->server.startpos = MAP_DEFAULT_STARTPOS; imap->server.tinyisles = MAP_DEFAULT_TINYISLES; imap->server.separatepoles = MAP_DEFAULT_SEPARATE_POLES; - imap->server.single_pole = MAP_DEFAULT_SINGLE_POLE; - imap->server.alltemperate = MAP_DEFAULT_ALLTEMPERATE; imap->server.temperature = MAP_DEFAULT_TEMPERATURE; imap->server.have_huts = FALSE; imap->server.have_resources = FALSE; diff --git a/common/map_types.h b/common/map_types.h index ce81c63ee9..824ee0f157 100644 --- a/common/map_types.h +++ b/common/map_types.h @@ -75,6 +75,8 @@ struct civ_map { struct iter_index *iterate_outwards_indices; int num_iterate_outwards_indices; int xsize, ysize; /* native dimensions */ + bool single_pole; + bool alltemperate; int num_continents; int num_oceans; /* not updated at the client */ struct tile *tiles; @@ -97,8 +99,6 @@ struct civ_map { bool tinyisles; bool separatepoles; int flatpoles; - bool single_pole; - bool alltemperate; int temperature; int wetness; int steepness; diff --git a/common/networking/packets.def b/common/networking/packets.def index be927a97a9..2752bb08e4 100644 --- a/common/networking/packets.def +++ b/common/networking/packets.def @@ -627,6 +627,8 @@ PACKET_MAP_INFO = 17; sc, lsend XYSIZE xsize; XYSIZE ysize; UINT8 topology_id; + BOOL alltemperate; + BOOL single_pole; end PACKET_NUKE_TILE_INFO = 18; sc, dsend,lsend diff --git a/server/generator/mapgen.c b/server/generator/mapgen.c index c9df51262e..703d25de6a 100644 --- a/server/generator/mapgen.c +++ b/server/generator/mapgen.c @@ -152,7 +152,7 @@ static void make_rivers(void); static void river_types_init(void); -#define HAS_POLES (wld.map.server.temperature < 70 && !wld.map.server.alltemperate) +#define HAS_POLES (wld.map.server.temperature < 70 && !wld.map.alltemperate) /* These are the old parameters of terrains types in % TODO: they depend on the hardcoded terrains */ diff --git a/server/generator/mapgen_topology.c b/server/generator/mapgen_topology.c index d83015dc70..add825d0d1 100644 --- a/server/generator/mapgen_topology.c +++ b/server/generator/mapgen_topology.c @@ -208,10 +208,10 @@ static int map_signed_latitude(const struct tile *ptile) /* TODO: Move upper and lower latitude bounds to server settings * (replacing alltemperate and singlepole). */ - if (wld.map.server.alltemperate) { + if (wld.map.alltemperate) { /* An all-temperate map has "average" temperature everywhere. */ north_latitude = south_latitude = MAX_COLATITUDE / 2; - } else if (wld.map.server.single_pole) { + } else if (wld.map.single_pole) { /* Partial planetary map. A polar zone is placed at the north end * and a tropical zone at the south end. */ north_latitude = MAX_COLATITUDE; @@ -456,7 +456,7 @@ void generator_init_topology(bool autosize) } /* correction for single pole (Flat Earth) */ - if (wld.map.server.single_pole) { + if (wld.map.single_pole) { if (!current_topo_has_flag(TF_WRAPY) || !current_topo_has_flag(TF_WRAPX)) { ice_base_colatitude /= 2; } diff --git a/server/generator/temperature_map.c b/server/generator/temperature_map.c index 04645c9dad..b17e8d5660 100644 --- a/server/generator/temperature_map.c +++ b/server/generator/temperature_map.c @@ -152,7 +152,7 @@ void create_tmap(bool real) /* Notice: if colatitude is loaded from a scenario never call adjust. Scenario may have an odd colatitude distribution and adjust will break it */ - if (!wld.map.server.alltemperate) { + if (!wld.map.alltemperate) { adjust_int_map(temperature_map, MAX_COLATITUDE); } /* now simplify to 4 base values */ diff --git a/server/maphand.c b/server/maphand.c index d883838276..d5f740ca43 100644 --- a/server/maphand.c +++ b/server/maphand.c @@ -633,6 +633,8 @@ void send_map_info(struct conn_list *dest) minfo.xsize = wld.map.xsize; minfo.ysize = wld.map.ysize; minfo.topology_id = wld.map.topology_id; + minfo.alltemperate = wld.map.alltemperate; + minfo.single_pole = wld.map.single_pole; lsend_packet_map_info(dest, &minfo); } diff --git a/server/settings.c b/server/settings.c index e5da74ea8f..45629d9ecc 100644 --- a/server/settings.c +++ b/server/settings.c @@ -1587,14 +1587,14 @@ static struct setting settings[] = { NULL, NULL, MAP_MIN_FLATPOLES, MAP_MAX_FLATPOLES, MAP_DEFAULT_FLATPOLES) - GEN_BOOL("singlepole", wld.map.server.single_pole, + GEN_BOOL("singlepole", wld.map.single_pole, SSET_MAP_GEN, SSET_GEOLOGY, SSET_SITUATIONAL, ALLOW_NONE, ALLOW_BASIC, N_("Whether there's just one pole generated"), N_("If this setting is enabled, only one side of the map will have " "a pole."), NULL, NULL, MAP_DEFAULT_SINGLE_POLE) - GEN_BOOL("alltemperate", wld.map.server.alltemperate, + GEN_BOOL("alltemperate", wld.map.alltemperate, SSET_MAP_GEN, SSET_GEOLOGY, SSET_RARE, ALLOW_NONE, ALLOW_BASIC, N_("All the map is temperate"), N_("If this setting is enabled, the temperature will be " -- 2.17.1