From 991e3c7f8f5492458551d25a719c3ada7500a6b7 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Fri, 28 Oct 2022 20:44:49 +0300 Subject: [PATCH 28/28] Send unknown score as -1 See osdn #45793 Signed-off-by: Marko Lindqvist --- client/plrdlg_common.c | 4 ++-- client/text.c | 8 +++----- common/networking/packets.def | 8 +++++--- fc_version | 2 +- server/plrhand.c | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/client/plrdlg_common.c b/client/plrdlg_common.c index 76257d243f..c25f266adf 100644 --- a/client/plrdlg_common.c +++ b/client/plrdlg_common.c @@ -307,8 +307,8 @@ static const char *col_idle(const struct player *plr) /************************************************************************//** Compare score of two players in players dialog ****************************************************************************/ -static int cmp_score(const struct player* player1, - const struct player* player2) +static int cmp_score(const struct player *player1, + const struct player *player2) { return player1->score.game - player2->score.game; } diff --git a/client/text.c b/client/text.c index ba1e51546f..e46c87a8fb 100644 --- a/client/text.c +++ b/client/text.c @@ -1638,9 +1638,7 @@ const char *get_score_text(const struct player *pplayer) astr_clear(&str); - if (pplayer->score.game > 0 - || NULL == client.conn.playing - || pplayer == client.conn.playing) { + if (pplayer->score.game >= 0) { astr_add(&str, "%d", pplayer->score.game); } else { astr_add(&str, "?"); @@ -1650,8 +1648,8 @@ const char *get_score_text(const struct player *pplayer) } /************************************************************************//** - Get the title for a "report". This may include the city, economy, - military, trade, player, etc., reports. Some clients may generate the + Get the title for a "report". This may include the city, economy, + military, trade, player, etc., reports. Some clients may generate the text themselves to get a better GUI layout. ****************************************************************************/ const char *get_report_title(const char *report_name) diff --git a/common/networking/packets.def b/common/networking/packets.def index b32d0f9ba8..d1ca54ac64 100644 --- a/common/networking/packets.def +++ b/common/networking/packets.def @@ -338,6 +338,8 @@ type TURN = SINT16 type XYSIZE = UINT16 type YEAR = SINT32 type CITIZENS = UINT8 +# Negative values used as flags +type SCORE = SINT32 /**************************************************** The remaining lines are the definition of the packets. These are @@ -444,8 +446,8 @@ end PACKET_ENDGAME_PLAYER = 223; sc, lsend, no-delta UINT8 category_num; PLAYER player_id; - UINT16 score; - UINT32 category_score[32:category_num]; + SCORE score; + SCORE category_score[32:category_num]; BOOL winner; end @@ -912,7 +914,7 @@ PACKET_PLAYER_INFO = 51; sc, is-info STRING username[MAX_LEN_NAME]; BOOL unassigned_user; - UINT32 score; + SCORE score; BOOL is_male; BOOL was_created; GOVERNMENT government; diff --git a/fc_version b/fc_version index eb8ae2d5df..61bb1e7fc6 100755 --- a/fc_version +++ b/fc_version @@ -61,7 +61,7 @@ DEFAULT_FOLLOW_TAG=S3_2 # - No new mandatory capabilities can be added to the release branch; doing # so would break network capability of supposedly "compatible" releases. # -NETWORK_CAPSTRING="+Freeciv.Devel-${MAIN_VERSION}-2022.Oct.28" +NETWORK_CAPSTRING="+Freeciv.Devel-${MAIN_VERSION}-2022.Oct.28b" FREECIV_DISTRIBUTOR="" diff --git a/server/plrhand.c b/server/plrhand.c index 0faab975cc..7ddb5261db 100644 --- a/server/plrhand.c +++ b/server/plrhand.c @@ -1358,7 +1358,7 @@ static void package_player_info(struct player *plr, if (info_level >= INFO_MEETING) { packet->score = plr->score.game; } else { - packet->score = 0; + packet->score = -1; } packet->autoselect_weight = plr->autoselect_weight; -- 2.35.1