From 39973437711afbf8b98ada693ada94478263a21b Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Sun, 28 Feb 2021 15:11:48 +0200 Subject: [PATCH 8/8] Make player history value 32bit value in network protocol Reported by mortmann See osdn #41654 Signed-off-by: Marko Lindqvist --- client/packhand.c | 6 +++++- common/packets.def | 3 ++- fc_version | 2 +- server/plrhand.c | 6 ++++-- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/client/packhand.c b/client/packhand.c index d1b9d1729a..ccc582b6e9 100644 --- a/client/packhand.c +++ b/client/packhand.c @@ -2272,7 +2272,11 @@ void handle_player_info(const struct packet_player_info *pinfo) } } - pplayer->history = pinfo->history; + if (has_capability("plrculture32", client.conn.capability)) { + pplayer->history = pinfo->history32; + } else { + pplayer->history = pinfo->history16; + } /* Don't use player_iterate or player_slot_count here, because we ignore * the real number of players and we want to read all the datas. */ diff --git a/common/packets.def b/common/packets.def index e22e25fff2..7e3e9aa96e 100644 --- a/common/packets.def +++ b/common/packets.def @@ -825,7 +825,8 @@ PACKET_PLAYER_INFO = 51; sc, is-info UINT8 ai_skill_level; BARBARIAN_TYPE barbarian_type; BV_PLAYER gives_shared_vision; - UINT16 history; + UINT16 history16; remove-cap(plrculture32) + UINT32 history32; add-cap(plrculture32) SINT16 love[MAX_NUM_PLAYER_SLOTS]; BOOL color_valid; diff --git a/fc_version b/fc_version index 09657c9aa4..b8c85617e2 100755 --- a/fc_version +++ b/fc_version @@ -57,7 +57,7 @@ DEFAULT_FOLLOW_TAG=stable # as long as possible. We want to maintain network compatibility with # the stable branch for as long as possible. NETWORK_CAPSTRING_MANDATORY="+Freeciv-2.6-network" -NETWORK_CAPSTRING_OPTIONAL="techloss_forgiveness year32" +NETWORK_CAPSTRING_OPTIONAL="techloss_forgiveness year32 plrculture32" FREECIV_DISTRIBUTOR="" diff --git a/server/plrhand.c b/server/plrhand.c index d9ccd22d28..2eec02cfd7 100644 --- a/server/plrhand.c +++ b/server/plrhand.c @@ -1233,10 +1233,12 @@ static void package_player_info(struct player *plr, } if (info_level >= INFO_FULL) { - packet->history = plr->history; + packet->history32 = plr->history; } else { - packet->history = 0; + packet->history32 = 0; } + + packet->history16 = packet->history32; } /************************************************************************** -- 2.30.1