From 4aec93cbb577ab3e2a253f6252d145eca26eff3c Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Tue, 17 Jan 2023 19:51:29 +0200 Subject: [PATCH 32/32] Add city tile output to city web-addition packet See osdn #46535 Signed-off-by: Marko Lindqvist --- common/networking/packets.def | 4 ++++ server/citytools.c | 11 +++++++++++ 2 files changed, 15 insertions(+) diff --git a/common/networking/packets.def b/common/networking/packets.def index 6474dc1e76..333e63fda3 100644 --- a/common/networking/packets.def +++ b/common/networking/packets.def @@ -2410,6 +2410,10 @@ PACKET_WEB_CITY_INFO_ADDITION = 256; sc, lsend, is-game-info, force, cancel(PACK BV_UTYPES can_build_unit; BV_IMPRS can_build_improvement; + + UINT8 output_food[MAX_CITY_TILES + 1]; + UINT8 output_shield[MAX_CITY_TILES + 1]; + UINT8 output_trade[MAX_CITY_TILES + 1]; end PACKET_WEB_CMA_SET = 257; cs, handle-via-fields diff --git a/server/citytools.c b/server/citytools.c index 513bef35ef..44591fb612 100644 --- a/server/citytools.c +++ b/server/citytools.c @@ -2664,6 +2664,8 @@ void package_city(struct city *pcity, struct packet_city_info *packet, #ifdef FREECIV_WEB if (web_packet != NULL) { + struct tile *pcenter = city_tile(pcity); + BV_CLR_ALL(web_packet->can_build_unit); BV_CLR_ALL(web_packet->can_build_improvement); @@ -2691,6 +2693,15 @@ void package_city(struct city *pcity, struct packet_city_info *packet, BV_SET(web_packet->can_build_unit, utype_index(punittype)); } } unit_type_iterate_end; + + i = 0; + city_tile_iterate(city_map_radius_sq_get(pcity), pcenter, ptile) { + web_packet->output_food[i] = city_tile_output_now(pcity, ptile, O_FOOD); + web_packet->output_shield[i] = city_tile_output_now(pcity, ptile, O_SHIELD); + web_packet->output_trade[i] = city_tile_output_now(pcity, ptile, O_TRADE); + + i++; + } city_tile_iterate_end; } #endif /* FREECIV_WEB */ } -- 2.39.0