From 285ea5af878df40da693c77bc3282d3c376b75b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C5=82awomir=20Lach?= Date: Sat, 20 Mar 2021 12:07:43 +0100 Subject: [PATCH] - Added basic counters init for city This patch added initial code for city' counter initialization --- common/city.h | 4 ++++ common/counters.h | 12 ++++++++++++ server/citytools.c | 3 +++ 3 files changed, 19 insertions(+) diff --git a/common/city.h b/common/city.h index ada4115c6a..f2588df0ba 100644 --- a/common/city.h +++ b/common/city.h @@ -22,6 +22,7 @@ extern "C" { #include "log.h" /* common */ +#include "counters.h" #include "fc_types.h" #include "name_translation.h" #include "improvement.h" @@ -426,6 +427,9 @@ struct city { void *ais[FREECIV_AI_MOD_LAST]; struct vision *vision; + + struct counters_of_this_vector counters; + } server; struct { diff --git a/common/counters.h b/common/counters.h index 6b2f94b8dc..eb5e498b37 100644 --- a/common/counters.h +++ b/common/counters.h @@ -16,6 +16,9 @@ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ + +/* common */ +#include "fc_types.h" enum counter_type { COUNTER_OWNED = 0, COUNTER_COUNT }; @@ -33,6 +36,15 @@ struct counter int index; /* index in specific (city/player/world) array */ }; +struct counter_actor_value +{ + int value; +}; + +#define SPECVEC_TAG counters_of_this +#define SPECVEC_TYPE struct counter_actor_value +#include "specvec.h" + void counters_init(void); void counters_free(void); diff --git a/server/citytools.c b/server/citytools.c index c2cdde6095..1c37d2b902 100644 --- a/server/citytools.c +++ b/server/citytools.c @@ -1609,6 +1609,9 @@ void create_city(struct player *pplayer, struct tile *ptile, send_city_info(city_owner(home), home); } } unit_list_iterate_end; + + + counters_of_this_vector_init(&pcity->server.counters); sanity_check_city(pcity); -- 2.30.2