From 788635d9707a7f37058787a4f8ae36664f3b2a55 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Mon, 11 Oct 2021 19:42:31 +0300 Subject: [PATCH 51/51] Never reveal the tile in send_city_info_at_tile() Callers that want that the tile gets revealed before it's sent should do the reveal themselves. The way send_city_info_at_tile() sometimes was revealing the tile was inconsistent and lead to bugs. See osdn #42967 Signed-off-by: Marko Lindqvist --- server/citytools.c | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/server/citytools.c b/server/citytools.c index 5011fa5652..4a2d93b198 100644 --- a/server/citytools.c +++ b/server/citytools.c @@ -2340,11 +2340,11 @@ void send_city_info_at_tile(struct player *pviewer, struct conn_list *dest, } } else { /* send info to non-owner */ - if (!pviewer) { /* observer */ + if (!pviewer) { /* observer */ if (pcity) { routes = traderoute_packet_list_new(); - package_city(pcity, &packet, &web_packet, routes, FALSE); /* should be dumb_city info? */ + package_city(pcity, &packet, &web_packet, routes, FALSE); /* should be dumb_city info? */ lsend_packet_city_info(dest, &packet, FALSE); web_lsend_packet(city_info_addition, dest, &web_packet, FALSE); traderoute_packet_list_iterate(routes, route_packet) { @@ -2352,21 +2352,18 @@ void send_city_info_at_tile(struct player *pviewer, struct conn_list *dest, } traderoute_packet_list_iterate_end; } } else { - if (!map_is_known(ptile, pviewer)) { - /* Without the conditional we'd have an infinite loop here. */ - map_show_tile(pviewer, ptile); - } if (map_is_known_and_seen(ptile, pviewer, V_MAIN)) { - if (pcity) { /* it's there and we see it; update and send */ - update_dumb_city(pviewer, pcity); - package_dumb_city(pviewer, ptile, &sc_pack); - lsend_packet_city_short_info(dest, &sc_pack); - } - } else { /* not seen; send old info */ - if (NULL != map_get_player_site(ptile, pviewer)) { - package_dumb_city(pviewer, ptile, &sc_pack); - lsend_packet_city_short_info(dest, &sc_pack); - } + if (pcity) { /* it's there and we see it; update and send */ + update_dumb_city(pviewer, pcity); + package_dumb_city(pviewer, ptile, &sc_pack); + lsend_packet_city_short_info(dest, &sc_pack); + } + } else { /* not seen; send old info */ + if (map_is_known(ptile, pviewer) + && map_get_player_site(ptile, pviewer) != NULL) { + package_dumb_city(pviewer, ptile, &sc_pack); + lsend_packet_city_short_info(dest, &sc_pack); + } } } } -- 2.33.0