From 5033399f5e50e7d8a76c59f96f633622ef36b215 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 | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/server/srv_main.c b/server/srv_main.c index 16e0f177c4..0abba72137 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,26 @@ 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; + turn_owned = counter_by_rule_name("Owned"); + + if (NULL != turn_owned && CTGT_CITY != turn_owned->target) { + + turn_owned = NULL; + } + /* Hack: because observer players never get an end-phase packet we send * one here. */ conn_list_iterate(game.est_connections, pconn) { @@ -1499,6 +1516,11 @@ static void end_turn(void) shields += pcity->prod[O_SHIELD]; food += pcity->prod[O_FOOD]; trade += pcity->prod[O_TRADE]; + + if (NULL != turn_owned) { + + ++pcity->counter_values[turn_owned->index]; + } } city_list_iterate_end; log_debug("%s T%d cities:%d pop:%d food:%d prod:%d " "trade:%d settlers:%d units:%d", player_name(pplayer), -- 2.35.1