From 4fcdc83edfd8850460e6070842f4b82f3e72312f Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Mon, 22 Aug 2022 20:29:50 +0300 Subject: [PATCH 52/52] Add server-side CMA info to PACKET_WEB_CITY_INFO_ADDITION See osdn #45268 Signed-off-by: Marko Lindqvist --- client/packhand.c | 4 +++- common/networking/packets.def | 4 ++++ fc_version | 2 +- server/citytools.c | 8 ++++++++ 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/client/packhand.c b/client/packhand.c index be31568fdd..c7bc531e59 100644 --- a/client/packhand.c +++ b/client/packhand.c @@ -988,7 +988,9 @@ void handle_city_info(const struct packet_city_info *packet) use for it. TODO: Do not generate code calling this in the C-client. ****************************************************************************/ -void handle_web_city_info_addition(int id, int granary_size, +void handle_web_city_info_addition(int id, bool cma_enabled, + const struct cm_parameter *cm_parameter, + int granary_size, int granary_turns) { } diff --git a/common/networking/packets.def b/common/networking/packets.def index ce49d66436..ce44d9fcfa 100644 --- a/common/networking/packets.def +++ b/common/networking/packets.def @@ -205,6 +205,7 @@ type WORKLIST = worklist(struct worklist) # string that is URI encoded in the JSON protocol type ESTRING = estring(char) type UNIT_ORDER = unit_order(struct unit_order) +type CM_PARAMETER = cm_parameter(struct cm_parameter) # typedefs for enums type ACHIEVEMENT_TYPE = uint8(enum achievement_type) @@ -2357,6 +2358,9 @@ end PACKET_WEB_CITY_INFO_ADDITION = 256; sc, lsend, is-game-info, force, cancel(PACKET_CITY_SHORT_INFO) CITY id; key + BOOL cma_enabled; + CM_PARAMETER cm_parameter; + UINT16 granary_size; TURN granary_turns; end diff --git a/fc_version b/fc_version index 8f63743629..5be1f7e109 100755 --- a/fc_version +++ b/fc_version @@ -60,7 +60,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-3.2-2022.Aug.21" +NETWORK_CAPSTRING="+Freeciv.Devel-3.2-2022.Aug.22" FREECIV_DISTRIBUTOR="" diff --git a/server/citytools.c b/server/citytools.c index 4a96a632de..138e8cb723 100644 --- a/server/citytools.c +++ b/server/citytools.c @@ -2629,6 +2629,14 @@ void package_city(struct city *pcity, struct packet_city_info *packet, if (web_packet != NULL) { web_packet->id = pcity->id; + if (pcity->cm_parameter != NULL) { + web_packet->cma_enabled = TRUE; + cm_copy_parameter(&web_packet->cm_parameter, pcity->cm_parameter); + } else { + web_packet->cma_enabled = TRUE; + memset(&web_packet->cm_parameter, 0, sizeof(web_packet->cm_parameter)); + } + web_packet->granary_size = city_granary_size(city_size_get(pcity)); web_packet->granary_turns = city_turns_to_grow(pcity); } -- 2.35.1