Am Dienstag, 15. November 2011, 22:24:29 schrieb Marko Lindqvist: > On 15 November 2011 22:48, Matthias Pfafferodt > > <matthias.pfaffer...@mapfa.de> wrote: > > If you plan to continue to support S2_3, I think it would be easier to > > rebase all longturn patches to S2_4 and do one patch which changes the > > network protocol to be compatible to S2_3. > > ... > > > I attached a file with the diff between S2_3 and S2_4 for packets.def. > > Most of the work to be done is to remove S2_4 features. The hardest part > > is the transmission of the veteran ruleset definitions (IMHO). > > Please note that there's more to network compatibility than > packets.def changes. While it lists all the packet fields there is in > the network protocol, legal ranges of those values can change outside > it, and even meaning of any single value (for example when value is > removed from the middle of enum) can change.
You are right. All the other things also have to be compared / checked. Yesterday evening I did create such a hack. The client 2.3 can connect but there are still some bugs as settlers can't build cities ...
From 45f5bc822f9e52c5943eb2ccd67be315dbc21e6b Mon Sep 17 00:00:00 2001 From: Matthias Pfafferodt <g...@mapfa.de> Date: Tue, 15 Nov 2011 23:30:19 +0100 Subject: [PATCH 1/2] use S2_3 protocol by S2_4 server (longturn) --- common/citizens.c | 10 +++--- common/game.h | 3 +- common/map.h | 6 +--- common/packets.def | 70 ++++++++++-------------------------------------- common/requirements.c | 22 --------------- common/requirements.h | 22 +++++++-------- common/unit.c | 7 ++++- fc_version | 4 +- server/citizenshand.c | 4 +- server/citytools.c | 18 ------------ server/cityturn.c | 6 ++-- server/edithand.c | 5 --- server/gamehand.c | 7 +++-- server/maphand.c | 15 ---------- server/plrhand.c | 13 +-------- server/ruleset.c | 58 +++++++++++++++++++--------------------- server/savegame2.c | 8 +++--- server/srv_main.c | 6 +--- server/unittools.c | 4 +-- 19 files changed, 86 insertions(+), 202 deletions(-) diff --git a/common/citizens.c b/common/citizens.c index f54c50f..5397412 100644 --- a/common/citizens.c +++ b/common/citizens.c @@ -32,7 +32,7 @@ void citizens_init(struct city *pcity) { fc_assert_ret(pcity); - if (game.info.citizen_nationality != TRUE) { + if (TRUE) { return; } @@ -73,7 +73,7 @@ void citizens_free(struct city *pcity) citizens citizens_nation_get(const struct city *pcity, const struct player_slot *pslot) { - if (game.info.citizen_nationality != TRUE) { + if (TRUE) { return 0; } @@ -105,7 +105,7 @@ void citizens_nation_add(struct city *pcity, const struct player_slot *pslot, { citizens nationality = citizens_nation_get(pcity, pslot); - if (game.info.citizen_nationality != TRUE) { + if (TRUE) { return; } @@ -144,7 +144,7 @@ void citizens_nation_move(struct city *pcity, void citizens_nation_set(struct city *pcity, const struct player_slot *pslot, citizens count) { - if (game.info.citizen_nationality != TRUE) { + if (TRUE) { return; } @@ -163,7 +163,7 @@ citizens citizens_count(const struct city *pcity) /* Use int here to check for an possible overflow at the end. */ int count = 0; - if (game.info.citizen_nationality != TRUE) { + if (TRUE) { return city_size_get(pcity); } diff --git a/common/game.h b/common/game.h index 5a30ca9..316ed93 100644 --- a/common/game.h +++ b/common/game.h @@ -158,6 +158,7 @@ struct civ_game { int unitwaittime; /* minimal time between two movements of a unit */ int upgrade_veteran_loss; bool vision_reveal_tiles; + int base_bribe_cost; bool debug[DEBUG_LAST]; int timeoutint; /* increase timeout every N turns... */ @@ -570,7 +571,7 @@ extern struct civ_game game; #define GAME_UNIT_BRIBE_DIST_MAX 32 /* Max number of recursive transports. */ -#define GAME_TRANSPORT_MAX_RECURSIVE 5 +#define GAME_TRANSPORT_MAX_RECURSIVE 1 /* ruleset settings */ diff --git a/common/map.h b/common/map.h index 9e70dee..35fe7a4 100644 --- a/common/map.h +++ b/common/map.h @@ -574,7 +574,7 @@ extern const int DIR_DY[8]; * below. */ #define MAP_DEFAULT_SIZE 4 #define MAP_MIN_SIZE 0 -#define MAP_MAX_SIZE 2048 +#define MAP_MAX_SIZE 128 FC_STATIC_ASSERT(MAP_MAX_SIZE * 1000 <= MAX_DBV_LENGTH, map_too_big_for_bitvector); @@ -585,9 +585,7 @@ FC_STATIC_ASSERT(MAP_MAX_SIZE * 1000 <= MAX_DBV_LENGTH, /* This defines the maximum linear size in _map_ coordinates. */ #define MAP_DEFAULT_LINEAR_SIZE 64 -/* 32 * 1024 is 2^15; thus, x*y is <= 2^15 * 2^15 = 2^30. This can be - * represented by an signed int as required by the network protocol. */ -#define MAP_MAX_LINEAR_SIZE (32 * 1024) +#define MAP_MAX_LINEAR_SIZE 512 #define MAP_MIN_LINEAR_SIZE 16 #define MAP_ORIGINAL_TOPO TF_WRAPX diff --git a/common/packets.def b/common/packets.def index b92abcf..75901b4 100644 --- a/common/packets.def +++ b/common/packets.def @@ -1,17 +1,5 @@ /* -Max used id: -============ - -Max id: 219 - -Packets are not ordered by their id, but by their category. New packet -with higher id may get added to existing category, and not to the end of file. -For this reason it's important to keep information about max id currently -in use updated here. So we know what ids are safe to use when adding new -packets. - - Syntax: Comments: @@ -267,7 +255,6 @@ type PHASE = SINT16 type TURN = SINT16 type XYSIZE = UINT16 type YEAR = SINT16 -type CITIZENS = UINT8 /**************************************************** The remaining lines are the definition of the packets. These are @@ -379,11 +366,10 @@ PACKET_TILE_INFO = 15; sc, lsend, is-game-info BOOL special[S_LAST]; BV_BASES bases; STRING spec_sprite[MAX_LEN_NAME]; - STRING label[MAX_LEN_NAME]; end # This packet used to have is_info set but that doesn't work with the -# seconds_to_phasedone field: sending the same value a second time after a +# seconds_to_phasedone fields: sending the same value a second time after a # while has passed means a completely reset timeout. # # The variables in the packet are listed in alphabetical order. @@ -397,12 +383,10 @@ PACKET_GAME_INFO = 16; sc UINT8 border_city_radius_sq; UINT8 border_size_effect; BORDERS_MODE borders; - UINT32 base_bribe_cost; BOOL calendar_skip_0; /* size limit for cities before they can celebrate */ UINT8 celebratesize; BOOL changable_tax; - BOOL citizen_nationality; UINT8 citymindist; UINT32 cooling; UINT32 coolinglevel; @@ -441,6 +425,7 @@ PACKET_GAME_INFO = 16; sc UINT8 killcitizen; BOOL killstack; UINT8 min_city_center_output[O_LAST]; + UINT8 min_dist_bw_cities; STRING negative_year_label[MAX_LEN_NAME]; UINT8 notradesize; BOOL nuclear_winter; @@ -453,7 +438,8 @@ PACKET_GAME_INFO = 16; sc BOOL restrictinfra; BOOL unreachable_protects; UINT32 sciencebox; - FLOAT10x3 seconds_to_phasedone; + FLOAT seconds_to_phasedone; remove-cap(timeout_extended_range) + FLOAT10x3 seconds_to_phasedone2; add-cap(timeout_extended_range) UINT32 shieldbox; UINT32 skill_level; BOOL slow_invasions; @@ -519,20 +505,13 @@ PACKET_CITY_INFO = 31; sc, lsend, is-game-info, force, cancel(PACKET_CITY_SHORT_ TILE tile; PLAYER owner; - CITIZENS size; + UINT8 size; UINT8 city_radius_sq; - CITIZENS ppl_happy[FEELING_LAST]; - CITIZENS ppl_content[FEELING_LAST]; - CITIZENS ppl_unhappy[FEELING_LAST]; - CITIZENS ppl_angry[FEELING_LAST]; + UINT8 ppl_happy[5], ppl_content[5], ppl_unhappy[5], ppl_angry[5]; UINT8 specialists_size; - CITIZENS specialists[SP_MAX:specialists_size]; - - UINT8 nationalities_count; - PLAYER nation_id[MAX_NUM_PLAYER_SLOTS:nationalities_count]; - CITIZENS nation_citizens[MAX_NUM_PLAYER_SLOTS:nationalities_count]; + UINT8 specialists[SP_MAX:specialists_size]; SINT16 surplus[O_LAST]; UINT16 waste[O_LAST]; @@ -705,10 +684,6 @@ PACKET_PLAYER_INFO = 51; sc, is-info STRING inventions[A_LAST+1]; SINT16 love[MAX_NUM_PLAYER_SLOTS]; - UINT8 color_red; - UINT8 color_green; - UINT8 color_blue; - CITY wonders[B_LAST]; diff end @@ -762,18 +737,18 @@ PACKET_UNIT_INFO = 63; sc, lsend, is-game-info, cancel(PACKET_UNIT_SHORT_INFO) UNIT id; key PLAYER owner; TILE tile; - DIRECTION facing; CITY homecity; UINT8 upkeep[O_LAST]; UINT8 veteran; BOOL ai, paradropped; - BOOL occupied, transported, done_moving; + BOOL transported, done_moving; UNIT_TYPE type; UNIT transported_by; /* Only valid if transported is set. */ UINT8 movesleft, hp, fuel, activity_count, changed_from_count; + UINT8 occupy; TILE goto_tile; ACTIVITY activity; SPECIAL activity_target; @@ -797,7 +772,6 @@ PACKET_UNIT_SHORT_INFO = 64; sc, lsend, is-game-info, cancel(PACKET_UNIT_INFO) UNIT id; key PLAYER owner; TILE tile; - DIRECTION facing; UNIT_TYPE type; UINT8 veteran; @@ -1046,7 +1020,6 @@ end PACKET_CLIENT_INFO = 119; cs, handle-per-conn GUI_TYPE gui; - STRING distribution[MAX_LEN_NAME]; end /************** New turn packets **********************/ @@ -1157,10 +1130,9 @@ PACKET_RULESET_UNIT = 140; sc, lsend UINT8 paratroopers_mr_req; UINT8 paratroopers_mr_sub; - UINT8 veteran_levels; - STRING veteran_name[MAX_VET_LEVELS:veteran_levels][MAX_LEN_NAME]; - UINT16 power_fact[MAX_VET_LEVELS:veteran_levels]; - UINT8 move_bonus[MAX_VET_LEVELS:veteran_levels]; + STRING veteran_name[MAX_VET_LEVELS][MAX_LEN_NAME]; + FLOAT power_fact[MAX_VET_LEVELS]; + UINT8 move_bonus[MAX_VET_LEVELS]; UINT8 bombard_rate; UINT8 city_size; @@ -1178,15 +1150,8 @@ PACKET_RULESET_GAME = 141; sc, lsend UINT8 default_specialist; TECH_LIST global_init_techs[MAX_NUM_TECH_LIST]; - - UINT8 veteran_levels; - STRING veteran_name[MAX_VET_LEVELS:veteran_levels][MAX_LEN_NAME]; - UINT16 power_fact[MAX_VET_LEVELS:veteran_levels]; - UINT8 move_bonus[MAX_VET_LEVELS:veteran_levels]; - - UINT8 background_red; - UINT8 background_green; - UINT8 background_blue; + UINT8 work_veteran_chance[MAX_VET_LEVELS]; + UINT8 veteran_chance[MAX_VET_LEVELS]; end PACKET_RULESET_SPECIALIST = 142; sc, lsend @@ -1350,11 +1315,7 @@ PACKET_RULESET_TERRAIN = 151; sc, lsend UINT8 rail_time; UINT8 clean_pollution_time; UINT8 clean_fallout_time; - - UINT8 color_red; - UINT8 color_green; - UINT8 color_blue; - + STRING helptext[MAX_LEN_PACKET]; end @@ -1654,7 +1615,6 @@ PACKET_EDIT_TILE = 206; cs, handle-per-conn, handle-via-packet RESOURCE resource; TERRAIN terrain; NATION startpos_nation; - STRING label[MAX_LEN_NAME]; end PACKET_EDIT_UNIT_CREATE = 207; cs, handle-per-conn, dsend diff --git a/common/requirements.c b/common/requirements.c index 3b192c6..6ea5e10 100644 --- a/common/requirements.c +++ b/common/requirements.c @@ -408,7 +408,6 @@ struct requirement req_from_str(const char *type, const char *range, case VUT_TERRAINCLASS: case VUT_BASE: invalid = (req.range != REQ_RANGE_LOCAL - && req.range != REQ_RANGE_CADJACENT && req.range != REQ_RANGE_ADJACENT); break; case VUT_ADVANCE: @@ -440,7 +439,6 @@ struct requirement req_from_str(const char *type, const char *range, case VUT_TERRAINALTER: /* XXX could in principle support ADJACENT */ case VUT_CITYTILE: invalid = (req.range != REQ_RANGE_LOCAL - && req.range != REQ_RANGE_CADJACENT && req.range != REQ_RANGE_ADJACENT); break; case VUT_MINYEAR: @@ -678,7 +676,6 @@ static int count_buildings_in_range(const struct player *target_player, /* TODO: other local targets */ return 0; } - case REQ_RANGE_CADJACENT: case REQ_RANGE_ADJACENT: return 0; case REQ_RANGE_COUNT: @@ -709,7 +706,6 @@ static bool is_tech_in_range(const struct player *target_player, case REQ_RANGE_WORLD: return game.info.global_advances[tech]; case REQ_RANGE_LOCAL: - case REQ_RANGE_CADJACENT: case REQ_RANGE_ADJACENT: case REQ_RANGE_CITY: case REQ_RANGE_CONTINENT: @@ -732,8 +728,6 @@ static bool is_special_in_range(const struct tile *target_tile, switch (range) { case REQ_RANGE_LOCAL: return target_tile && tile_has_special(target_tile, special); - case REQ_RANGE_CADJACENT: - return target_tile && is_special_card_near(target_tile, special, TRUE); case REQ_RANGE_ADJACENT: return target_tile && is_special_near_tile(target_tile, special, TRUE); case REQ_RANGE_CITY: @@ -763,8 +757,6 @@ static bool is_terrain_in_range(const struct tile *target_tile, case REQ_RANGE_LOCAL: /* The requirement is filled if the tile has the terrain. */ return pterrain && tile_terrain(target_tile) == pterrain; - case REQ_RANGE_CADJACENT: - return pterrain && is_terrain_card_near(target_tile, pterrain, TRUE); case REQ_RANGE_ADJACENT: return pterrain && is_terrain_near_tile(target_tile, pterrain, TRUE); case REQ_RANGE_CITY: @@ -794,8 +786,6 @@ static bool is_terrain_class_in_range(const struct tile *target_tile, case REQ_RANGE_LOCAL: /* The requirement is filled if the tile has the terrain of correct class. */ return terrain_belongs_to_class(tile_terrain(target_tile), class); - case REQ_RANGE_CADJACENT: - return is_terrain_class_card_near(target_tile, class); case REQ_RANGE_ADJACENT: return is_terrain_class_near_tile(target_tile, class); case REQ_RANGE_CITY: @@ -825,8 +815,6 @@ static bool is_base_type_in_range(const struct tile *target_tile, case REQ_RANGE_LOCAL: /* The requirement is filled if the tile has base of requested type. */ return tile_has_base(target_tile, pbase); - case REQ_RANGE_CADJACENT: - return is_base_card_near(target_tile, pbase); case REQ_RANGE_ADJACENT: return is_base_near_tile(target_tile, pbase); case REQ_RANGE_CITY: @@ -857,7 +845,6 @@ static bool is_terrain_alter_possible_in_range(const struct tile *target_tile, case REQ_RANGE_LOCAL: return terrain_can_support_alteration(tile_terrain(target_tile), alteration); - case REQ_RANGE_CADJACENT: case REQ_RANGE_ADJACENT: /* XXX Could in principle support ADJACENT. */ case REQ_RANGE_CITY: case REQ_RANGE_CONTINENT: @@ -885,7 +872,6 @@ static bool is_nation_in_range(const struct player *target_player, return (NULL != nation->player && (survives || nation->player->is_alive)); case REQ_RANGE_LOCAL: - case REQ_RANGE_CADJACENT: case REQ_RANGE_ADJACENT: case REQ_RANGE_CITY: case REQ_RANGE_CONTINENT: @@ -992,14 +978,6 @@ static bool is_citytile_in_range(const struct tile *target_tile, switch (range) { case REQ_RANGE_LOCAL: return is_city_in_tile(target_tile, target_city); - case REQ_RANGE_CADJACENT: - cardinal_adjc_iterate(target_tile, adjc_tile) { - if (is_city_in_tile(adjc_tile, target_city)) { - return TRUE; - } - } cardinal_adjc_iterate_end; - - return FALSE; case REQ_RANGE_ADJACENT: adjc_iterate(target_tile, adjc_tile) { if (is_city_in_tile(adjc_tile, target_city)) { diff --git a/common/requirements.h b/common/requirements.h index 1558826..552f684 100644 --- a/common/requirements.h +++ b/common/requirements.h @@ -28,18 +28,16 @@ extern "C" { #define SPECENUM_NAME req_range #define SPECENUM_VALUE0 REQ_RANGE_LOCAL #define SPECENUM_VALUE0NAME "Local" -#define SPECENUM_VALUE1 REQ_RANGE_CADJACENT -#define SPECENUM_VALUE1NAME "CAdjacent" -#define SPECENUM_VALUE2 REQ_RANGE_ADJACENT -#define SPECENUM_VALUE2NAME "Adjacent" -#define SPECENUM_VALUE3 REQ_RANGE_CITY -#define SPECENUM_VALUE3NAME "City" -#define SPECENUM_VALUE4 REQ_RANGE_CONTINENT -#define SPECENUM_VALUE4NAME "Continent" -#define SPECENUM_VALUE5 REQ_RANGE_PLAYER -#define SPECENUM_VALUE5NAME "Player" -#define SPECENUM_VALUE6 REQ_RANGE_WORLD -#define SPECENUM_VALUE6NAME "World" +#define SPECENUM_VALUE1 REQ_RANGE_ADJACENT +#define SPECENUM_VALUE1NAME "Adjacent" +#define SPECENUM_VALUE2 REQ_RANGE_CITY +#define SPECENUM_VALUE2NAME "City" +#define SPECENUM_VALUE3 REQ_RANGE_CONTINENT +#define SPECENUM_VALUE3NAME "Continent" +#define SPECENUM_VALUE4 REQ_RANGE_PLAYER +#define SPECENUM_VALUE4NAME "Player" +#define SPECENUM_VALUE5 REQ_RANGE_WORLD +#define SPECENUM_VALUE5NAME "World" #define SPECENUM_COUNT REQ_RANGE_COUNT /* keep this last */ #include "specenum_gen.h" diff --git a/common/unit.c b/common/unit.c index 4983c99..50d7baf 100644 --- a/common/unit.c +++ b/common/unit.c @@ -2007,7 +2007,12 @@ int unit_bribe_cost(struct unit *punit) fc_assert_ret_val(punit != NULL, 0); default_hp = unit_type(punit)->hp; - cost = unit_owner(punit)->economic.gold + game.info.base_bribe_cost; + if (is_server()) { + cost = unit_owner(punit)->economic.gold + game.server.base_bribe_cost; + } else { + log_error("S2_3 compatibility - do not use this build for a client!"); + cost = unit_owner(punit)->economic.gold; + } capital = player_capital(unit_owner(punit)); /* Consider the distance to the capital. */ diff --git a/fc_version b/fc_version index efbc6ea..3dfee77 100755 --- a/fc_version +++ b/fc_version @@ -29,8 +29,8 @@ DATASUBDIR=2.4 # - Avoid adding a new mandatory capability to the development branch for # as long as possible. We want to maintain network compatibility with # the stable branch for as long as possible. -NETWORK_CAPSTRING_MANDATORY="+Freeciv.Devel-2.4-2011.Nov.11" -NETWORK_CAPSTRING_OPTIONAL="" +NETWORK_CAPSTRING_MANDATORY="+Freeciv-2.3-network" +NETWORK_CAPSTRING_OPTIONAL="timeout_extended_range" FREECIV_DISTRIBUTOR="" diff --git a/server/citizenshand.c b/server/citizenshand.c index 2714458..2b7e9e3 100644 --- a/server/citizenshand.c +++ b/server/citizenshand.c @@ -62,7 +62,7 @@ void citizens_update(struct city *pcity) city_refresh(pcity); sanity_check_city(pcity); - if (game.info.citizen_nationality != TRUE) { + if (TRUE) { return; } @@ -147,7 +147,7 @@ void citizens_print(const struct city *pcity) { fc_assert_ret(pcity); - if (game.info.citizen_nationality != TRUE) { + if (TRUE) { return; } diff --git a/server/citytools.c b/server/citytools.c index e3d6ad8..7b1b1b0 100644 --- a/server/citytools.c +++ b/server/citytools.c @@ -2000,24 +2000,6 @@ void package_city(struct city *pcity, struct packet_city_info *packet, ppl += packet->specialists[sp]; } specialist_type_iterate_end; - /* The nationality of the citizens. */ - packet->nationalities_count = 0; - if (game.info.citizen_nationality == TRUE) { - player_slots_iterate(pslot) { - citizens nationality = citizens_nation_get(pcity, pslot); - if (nationality != 0) { - /* This player should exist! */ - fc_assert(player_slot_get_player(pslot) != NULL); - - packet->nation_id[packet->nationalities_count] - = player_slot_index(pslot); - packet->nation_citizens[packet->nationalities_count] - = nationality; - packet->nationalities_count++; - } - } player_slots_iterate_end; - } - if (packet->size != ppl) { static bool recursion = FALSE; diff --git a/server/cityturn.c b/server/cityturn.c index b27e443..fc47bcf 100644 --- a/server/cityturn.c +++ b/server/cityturn.c @@ -2610,7 +2610,7 @@ static bool do_city_migration(struct city *pcity_from, * migration -> grow -> migration -> ... cycles) */ pcity_from->food_stock /= 2; - if (game.info.citizen_nationality == TRUE) { + if (FALSE) { /* Can citizens go to a city of their original nation? */ if (citizens_nation_get(pcity_from, pplayer_to->slot) > 0) { pplayer_citizen = pplayer_to; @@ -2646,7 +2646,7 @@ static bool do_city_migration(struct city *pcity_from, } /* raise size of receiver city */ - if (game.info.citizen_nationality == TRUE) { + if (FALSE) { /* Add one citizens; this must be followed by city_increase_size(). */ fc_assert_ret_val(pplayer_citizen != NULL, FALSE); citizens_nation_add(pcity_to, pplayer_citizen->slot, 1); @@ -2798,7 +2798,7 @@ static void check_city_migrations_player(const struct player *pplayer) } else if (game.server.mgr_worldchance > 0 && city_owner(acity) != pplayer) { /* migration between cities of different owners */ - if (game.info.citizen_nationality == TRUE) { + if (FALSE) { /* Modify the score if citizens could migrate to a city of their * original nation. */ if (citizens_nation_get(pcity, city_owner(acity)->slot) > 0) { diff --git a/server/edithand.c b/server/edithand.c index b863683..89b53e0 100644 --- a/server/edithand.c +++ b/server/edithand.c @@ -499,11 +499,6 @@ void handle_edit_tile(struct connection *pc, changed = TRUE; } - /* Handle changes in label */ - if (tile_set_label(ptile, packet->label)) { - changed = TRUE; - } - /* TODO: Handle more property edits. */ diff --git a/server/gamehand.c b/server/gamehand.c index ac929ba..b5c0cfa 100644 --- a/server/gamehand.c +++ b/server/gamehand.c @@ -489,11 +489,12 @@ void send_game_info(struct conn_list *dest) * but the server's timer is only ever reset at the start of a phase * (and game.info.seconds_to_phasedone is relative to this). * Account for the difference. */ - ginfo.seconds_to_phasedone = game.info.seconds_to_phasedone - - read_timer_seconds(game.server.phase_timer); + ginfo.seconds_to_phasedone2 = + ginfo.seconds_to_phasedone = game.info.seconds_to_phasedone + - read_timer_seconds(game.server.phase_timer); } else { /* unused but at least initialized */ - ginfo.seconds_to_phasedone = -1.0; + ginfo.seconds_to_phasedone2 = ginfo.seconds_to_phasedone = -1.0; } conn_list_iterate(dest, pconn) { diff --git a/server/maphand.c b/server/maphand.c index adbeb52..af64a90 100644 --- a/server/maphand.c +++ b/server/maphand.c @@ -441,12 +441,6 @@ void send_tile_info(struct conn_list *dest, struct tile *ptile, } tile_special_type_iterate_end; info.bases = ptile->bases; - if (ptile->label != NULL) { - strncpy(info.label, ptile->label, sizeof(info.label)); - } else { - info.label[0] = '\0'; - } - send_packet_tile_info(pconn, &info); } else if (pplayer && map_is_known(ptile, pplayer)) { struct player_tile *plrtile = map_get_player_tile(ptile, pplayer); @@ -474,13 +468,6 @@ void send_tile_info(struct conn_list *dest, struct tile *ptile, } tile_special_type_iterate_end; info.bases = plrtile->bases; - /* Labels never change, so they are not subject to fog of war */ - if (ptile->label != NULL) { - strncpy(info.label, ptile->label, sizeof(info.label)); - } else { - info.label[0] = '\0'; - } - send_packet_tile_info(pconn, &info); } else if (send_unknown) { info.known = TILE_UNKNOWN; @@ -496,8 +483,6 @@ void send_tile_info(struct conn_list *dest, struct tile *ptile, } tile_special_type_iterate_end; BV_CLR_ALL(info.bases); - info.label[0] = '\0'; - send_packet_tile_info(pconn, &info); } } diff --git a/server/plrhand.c b/server/plrhand.c index de974ff..5e814bc 100644 --- a/server/plrhand.c +++ b/server/plrhand.c @@ -860,17 +860,6 @@ static void package_player_info(struct player *plr, } } players_iterate_end; - if (plr->rgb != NULL) { - packet->color_red = plr->rgb->r; - packet->color_green = plr->rgb->g; - packet->color_blue = plr->rgb->b; - } else { - /* Use dummy values. */ - packet->color_red = 0; - packet->color_green = 0; - packet->color_blue = 0; - } - /* Only send score if we have contact */ if (info_level >= INFO_MEETING) { packet->score = plr->score.game; @@ -1251,7 +1240,7 @@ void server_remove_player(struct player *pplayer) /* Remove citizens of this player from the cities of all other players. */ /* FIXME: add a special case if the server quits - no need to run this for * each player in that case. */ - if (game.info.citizen_nationality == TRUE) { + if (FALSE) { cities_iterate(pcity) { if (city_owner(pcity) != pplayer) { citizens nationality = citizens_nation_get(pcity, pplayer->slot); diff --git a/server/ruleset.c b/server/ruleset.c index cac670c..5d1b4e6 100644 --- a/server/ruleset.c +++ b/server/ruleset.c @@ -66,6 +66,7 @@ #include "ruleset.h" +#define MAX_VET_LEVELS_S2_3 10 #define RULESET_CAPABILITIES "+Freeciv-2.4-ruleset" /* @@ -3076,10 +3077,9 @@ static void load_ruleset_cities(struct section_file *file) game.server.vision_reveal_tiles = secfile_lookup_bool_default(file, FALSE, "parameters.vision_reveal_tiles"); - /* Citizens configuration. */ - game.info.citizen_nationality = - secfile_lookup_bool_default(file, FALSE, - "citizen.nationality"); + /* Citizens configuration - not used at all! (S2_3) */ + secfile_lookup_bool_default(file, FALSE, + "citizen.nationality"); /* City Styles ... */ sec = secfile_sections_by_name_prefix(file, CITYSTYLE_SECTION_PREFIX); @@ -3295,7 +3295,7 @@ static void load_ruleset_game(void) RS_MAX_FOOD_COST, "civstyle.food_cost"); /* TODO: move to global_unit_options */ - game.info.base_bribe_cost + game.server.base_bribe_cost = secfile_lookup_int_default_min_max(file, RS_DEFAULT_BASE_BRIBE_COST, RS_MIN_BASE_BRIBE_COST, @@ -3383,6 +3383,9 @@ static void load_ruleset_game(void) get_output_identifier(o)); } output_type_iterate_end; + /* S2_3 compatibility. */ + game.info.min_dist_bw_cities = game.info.citymindist; + sval = secfile_lookup_str(file, "civstyle.nuke_contamination" ); if (fc_strcasecmp(sval, "Pollution") == 0) { game.server.nuke_contamination = CONTAMINATION_POLLUTION; @@ -3672,20 +3675,20 @@ static void send_ruleset_units(struct conn_list *dest) packet.cargo = u->cargo; packet.targets = u->targets; - if (u->veteran == NULL) { - /* Use the default veteran system. */ - packet.veteran_levels = 0; - } else { - /* Per unit veteran system definition. */ - packet.veteran_levels = utype_veteran_levels(u); - - for (i = 0; i < packet.veteran_levels; i++) { - const struct veteran_level *vlevel = utype_veteran_level(u, i); + { + /* Veteran data - S2_3 compatibility. */ + for (i = 0; i < MIN(game.veteran->levels, MAX_VET_LEVELS_S2_3); i++) { + const struct veteran_level *vlevel = game.veteran->definitions + i; sz_strlcpy(packet.veteran_name[i], untranslated_name(&vlevel->name)); packet.power_fact[i] = vlevel->power_fact; packet.move_bonus[i] = vlevel->move_bonus; } + for (; i < MAX_VET_LEVELS_S2_3; i++) { + sz_strlcpy(packet.veteran_name[i], ""); + packet.power_fact[i] = 0; + packet.move_bonus[i] = 0; + } } PACKET_STRVEC_COMPUTE(packet.helptext, u->helptext); @@ -3847,10 +3850,6 @@ static void send_ruleset_terrain(struct conn_list *dest) packet.flags = pterrain->flags; - packet.color_red = pterrain->rgb->r; - packet.color_green = pterrain->rgb->g; - packet.color_blue = pterrain->rgb->b; - PACKET_STRVEC_COMPUTE(packet.helptext, pterrain->helptext); lsend_packet_ruleset_terrain(dest, &packet); @@ -4061,15 +4060,18 @@ static void send_ruleset_game(struct conn_list *dest) fc_assert_ret(game.veteran != NULL); - /* Per unit veteran system definition. */ - misc_p.veteran_levels = game.veteran->levels; - - for (i = 0; i < misc_p.veteran_levels; i++) { - const struct veteran_level *vlevel = game.veteran->definitions + i; + { + /* Veteran data - S2_3 compatibility. */ + for (i = 0; i < MIN(game.veteran->levels, MAX_VET_LEVELS_S2_3); i++) { + const struct veteran_level *vlevel = game.veteran->definitions + i; - sz_strlcpy(misc_p.veteran_name[i], untranslated_name(&vlevel->name)); - misc_p.power_fact[i] = vlevel->power_fact; - misc_p.move_bonus[i] = vlevel->move_bonus; + misc_p.work_veteran_chance[i] = vlevel->work_raise_chance; + misc_p.veteran_chance[i] = vlevel->raise_chance; + } + for (; i < MAX_VET_LEVELS_S2_3; i++) { + misc_p.work_veteran_chance[i] = 0; + misc_p.veteran_chance[i] = 0; + } } fc_assert(sizeof(misc_p.global_init_techs) @@ -4083,10 +4085,6 @@ static void send_ruleset_game(struct conn_list *dest) fc_assert_ret(game.plr_bg_color != NULL); - misc_p.background_red = game.plr_bg_color->r; - misc_p.background_green = game.plr_bg_color->g; - misc_p.background_blue = game.plr_bg_color->b; - lsend_packet_ruleset_game(dest, &misc_p); } diff --git a/server/savegame2.c b/server/savegame2.c index a74d49e..5a99095 100644 --- a/server/savegame2.c +++ b/server/savegame2.c @@ -4086,7 +4086,7 @@ static void sg_load_player_city_citizens(struct loaddata *loading, struct city *pcity, const char *citystr) { - if (game.info.citizen_nationality == TRUE) { + if (FALSE) { citizens size; citizens_init(pcity); @@ -4137,7 +4137,7 @@ static void sg_save_player_cities(struct savedata *saving, secfile_insert_int(saving->file, city_list_size(plr->cities), "player%d.ncities", plrno); - if (game.info.citizen_nationality == TRUE) { + if (FALSE) { /* Initialise the nation list for the citizens information. */ player_slots_iterate(pslot) { nations[player_slot_index(pslot)] = FALSE; @@ -4154,7 +4154,7 @@ static void sg_save_player_cities(struct savedata *saving, wlist_max_length = pcity->worklist.length; } - if (game.info.citizen_nationality == TRUE) { + if (FALSE) { /* Find all nations of the citizens,*/ players_iterate(pplayer) { if (!nations[player_index(pplayer)] @@ -4276,7 +4276,7 @@ static void sg_save_player_cities(struct savedata *saving, CALL_FUNC_EACH_AI(city_save, saving->file, pcity, buf); - if (game.info.citizen_nationality == TRUE) { + if (FALSE) { /* Save nationality of the citizens,*/ players_iterate(pplayer) { if (nations[player_index(pplayer)]) { diff --git a/server/srv_main.c b/server/srv_main.c index 38c667d..b30224d 100644 --- a/server/srv_main.c +++ b/server/srv_main.c @@ -251,13 +251,9 @@ void srv_init(void) /************************************************************************** Handle client info packet **************************************************************************/ -void handle_client_info(struct connection *pc, enum gui_type gui, - const char *distribution) +void handle_client_info(struct connection *pc, enum gui_type gui) { log_debug("%s's client has %s gui.", pc->username, gui_type_name(gui)); - if (strcmp(distribution, "")) { - log_debug("It comes from %s distribution.", distribution); - } } /************************************************************************** diff --git a/server/unittools.c b/server/unittools.c index 2aa333f..cb4ff04 100644 --- a/server/unittools.c +++ b/server/unittools.c @@ -1908,7 +1908,6 @@ void package_unit(struct unit *punit, struct packet_unit_info *packet) packet->id = punit->id; packet->owner = player_number(unit_owner(punit)); packet->tile = tile_index(unit_tile(punit)); - packet->facing = punit->facing; packet->homecity = punit->homecity; output_type_iterate(o) { packet->upkeep[o] = punit->upkeep[o]; @@ -1938,7 +1937,7 @@ void package_unit(struct unit *punit, struct packet_unit_info *packet) packet->transported = TRUE; packet->transported_by = unit_transport_get(punit)->id; } - packet->occupied = (get_transporter_occupancy(punit) > 0); + packet->occupy = get_transporter_occupancy(punit); packet->battlegroup = punit->battlegroup; packet->has_orders = punit->has_orders; if (punit->has_orders) { @@ -1987,7 +1986,6 @@ void package_short_unit(struct unit *punit, packet->id = punit->id; packet->owner = player_number(unit_owner(punit)); packet->tile = tile_index(unit_tile(punit)); - packet->facing = punit->facing; packet->veteran = punit->veteran; packet->type = utype_number(unit_type(punit)); packet->hp = punit->hp; -- 1.7.1
_______________________________________________ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev