From 572c189d41364d4ed70566e826c9fb7abbc777fa Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Mon, 12 Jun 2023 05:09:24 +0300 Subject: [PATCH 39/39] Protocol: Fix sending gives_shared_tiles See osdn #48119 Signed-off-by: Marko Lindqvist --- server/plrhand.c | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/server/plrhand.c b/server/plrhand.c index 07f9efe55f..421dd4b02c 100644 --- a/server/plrhand.c +++ b/server/plrhand.c @@ -1320,7 +1320,7 @@ static void package_player_info(struct player *plr, info_level = min_info_level; } - /* multipliers */ + /* Multipliers */ packet->multip_count = multiplier_count(); if (info_level >= INFO_FULL) { multipliers_iterate(pmul) { @@ -1409,23 +1409,34 @@ static void package_player_info(struct player *plr, player_has_real_embassy(plr, pother); } players_iterate_end; packet->gives_shared_vision = plr->gives_shared_vision; + packet->gives_shared_tiles = plr->gives_shared_tiles; } else { packet->target_government = packet->government; memset(&packet->real_embassy, 0, sizeof(packet->real_embassy)); - if (receiver && player_has_real_embassy(plr, receiver)) { - packet->real_embassy[player_index(receiver)] = TRUE; - } - BV_CLR_ALL(packet->gives_shared_vision); - if (receiver && gives_shared_vision(plr, receiver)) { - BV_SET(packet->gives_shared_vision, player_index(receiver)); + BV_CLR_ALL(packet->gives_shared_tiles); + + if (receiver != NULL) { + int ridx = player_index(receiver); + + if (player_has_real_embassy(plr, receiver)) { + packet->real_embassy[ridx] = TRUE; + } + + if (gives_shared_vision(plr, receiver)) { + BV_SET(packet->gives_shared_vision, ridx); + } + + if (gives_shared_tiles(plr, receiver)) { + BV_SET(packet->gives_shared_tiles, ridx); + } } } /* Make absolutely sure - in case you lose your embassy! */ if (info_level >= INFO_EMBASSY || (receiver - && player_diplstate_get(plr, receiver)->type == DS_TEAM)) { + && player_diplstate_get(plr, receiver)->type == DS_TEAM)) { packet->tech_upkeep = player_tech_upkeep(plr); } else { packet->tech_upkeep = 0; @@ -1541,7 +1552,7 @@ static void package_player_diplstate(struct player *plr1, Return level of information player should receive about another. **************************************************************************/ static enum plr_info_level player_info_level(struct player *plr, - struct player *receiver) + struct player *receiver) { if (S_S_RUNNING > server_state()) { return INFO_MINIMUM; @@ -1555,6 +1566,7 @@ static enum plr_info_level player_info_level(struct player *plr, if (receiver && could_intel_with_player(receiver, plr)) { return INFO_MEETING; } + return INFO_MINIMUM; } -- 2.39.2