From 504be468d936a70127109593e75753b0e1275428 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C5=82awomir=20Lach?= Date: Tue, 8 Feb 2022 10:43:16 +0100 Subject: [PATCH] - Increase counter "Owned" value of each city Increase counter "Owned" value at end of each turn (for each city) --- server/srv_main.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/server/srv_main.c b/server/srv_main.c index 16e0f177c4..d09b3fa1c2 100644 --- a/server/srv_main.c +++ b/server/srv_main.c @@ -67,6 +67,7 @@ #include "calendar.h" #include "capstr.h" #include "city.h" +#include "counters.h" #include "culture.h" #include "dataio.h" #include "effects.h" @@ -1469,10 +1470,17 @@ static void end_phase(void) **************************************************************************/ static void end_turn(void) { + struct counter *turn_owned = NULL; int food = 0, shields = 0, trade = 0, settlers = 0; log_debug("Endturn"); + city_counters_iterrate(pcount) { + if (pcount->type == COUNTER_OWNED) { + turn_owned = pcount; + } + } city_counters_iterrate_end; + /* Hack: because observer players never get an end-phase packet we send * one here. */ conn_list_iterate(game.est_connections, pconn) { @@ -1485,6 +1493,14 @@ static void end_turn(void) map_calculate_borders(); + /* Update city's counter values */ + players_iterate(pplayer) { + city_list_iterate(pplayer->cities, pcity) { + if (NULL != turn_owned) { + pcity->counter_values[turn_owned->index]++; + } + } city_list_iterate_end; + } players_iterate_end; /* Output some AI measurement information */ players_iterate(pplayer) { if (!is_ai(pplayer) || is_barbarian(pplayer)) { -- 2.35.1