From f43115f9016c3e1ea4dfacb5efa4a92abbb985fe Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Wed, 23 Mar 2022 18:28:38 +0200 Subject: [PATCH 36/36] broadcast_city_info(): Send info to all players, not to owner multiple times Info was being sent to owner once for each other player that could see city internals, also when the info was not meant to be sent to owner at all. It was not sent to those other players who it was meant to. Reported by Lexxie See osdn #44158 Signed-off-by: Marko Lindqvist --- server/citytools.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/server/citytools.c b/server/citytools.c index adc27a8e10..ada6227b22 100644 --- a/server/citytools.c +++ b/server/citytools.c @@ -2180,21 +2180,19 @@ void broadcast_city_info(struct city *pcity) package_city(pcity, &packet, &web_packet, routes, FALSE); players_iterate(pplayer) { - if (can_player_see_city_internals(pplayer, pcity)) { - if (!send_city_suppressed || pplayer != powner) { - update_dumb_city(powner, pcity); - lsend_packet_city_info(powner->connections, &packet, FALSE); - web_lsend_packet(city_info_addition, powner->connections, &web_packet, FALSE); + if (!send_city_suppressed || pplayer != powner) { + if (can_player_see_city_internals(pplayer, pcity)) { + update_dumb_city(pplayer, pcity); + lsend_packet_city_info(pplayer->connections, &packet, FALSE); + web_lsend_packet(city_info_addition, pplayer->connections, &web_packet, FALSE); traderoute_packet_list_iterate(routes, route_packet) { - lsend_packet_traderoute_info(powner->connections, route_packet); + lsend_packet_traderoute_info(pplayer->connections, route_packet); } traderoute_packet_list_iterate_end; - } - } else { - if (player_can_see_city_externals(pplayer, pcity)) { + } else if (player_can_see_city_externals(pplayer, pcity)) { reality_check_city(pplayer, pcity->tile); - update_dumb_city(pplayer, pcity); - package_dumb_city(pplayer, pcity->tile, &sc_pack); - lsend_packet_city_short_info(pplayer->connections, &sc_pack); + update_dumb_city(pplayer, pcity); + package_dumb_city(pplayer, pcity->tile, &sc_pack); + lsend_packet_city_short_info(pplayer->connections, &sc_pack); } } } players_iterate_end; -- 2.35.1