From fad3096ab1c13bc99b308339bec3eecc06af940f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C5=82awomir=20Lach?= Date: Tue, 6 Dec 2022 13:59:20 +0100 Subject: [PATCH] =?UTF-8?q?!OSDN:=20#TICKET:=2045488=20-=20S=C5=82awomir?= =?UTF-8?q?=20Lach=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ruleset author could now count how many turns city's celebrating by using special counter. diff --git a/common/fc_types.h b/common/fc_types.h index 38de637c6c..010aab5646 100644 --- a/common/fc_types.h +++ b/common/fc_types.h @@ -110,6 +110,8 @@ enum output_type_id { #define SPECENUM_NAME counter_behaviour #define SPECENUM_VALUE1 CB_CITY_OWNED_TURNS #define SPECENUM_VALUE1NAME "Owned" +#define SPECENUM_VALUE2 CB_CITY_CELEBRATION_TURNS +#define SPECENUM_VALUE2NAME "Celebration" #define SPECENUM_COUNT COUNTER_BEHAVIOUR_LAST #include "specenum_gen.h" diff --git a/server/citytools.c b/server/citytools.c index fff72c22d8..05c0e05ac9 100644 --- a/server/citytools.c +++ b/server/citytools.c @@ -2336,6 +2336,11 @@ void send_city_info(struct player *dest, struct city *pcity) send_city_info_at_tile(dest, dest->connections, pcity, pcity->tile); } + /* Sending counters */ + city_counters_iterate(pcount) { + city_counter_refresh(pcity, pcount->index); + } city_counters_iterate_end; + if (game.info.team_pooled_research && player_list_size(team_members(powner->team)) > 1) { /* We want to send the new total bulbs production of the team. */ diff --git a/server/cityturn.c b/server/cityturn.c index 57df7a36a1..6cb18b1cb1 100644 --- a/server/cityturn.c +++ b/server/cityturn.c @@ -3345,6 +3345,14 @@ static void update_city_activity(struct city *pcity) if (city_celebrating(pcity) || is_celebrating) { pcity->rapture++; + + /* Update city's celebrating counters */ + city_counters_iterate(pcount) { + if (pcount->type == CB_CITY_CELEBRATION_TURNS) { + pcity->counter_values[pcount->index]++; + } + } city_counters_iterate_end; + if (pcity->rapture == 1) { notify_player(pplayer, city_tile(pcity), E_CITY_LOVE, ftc_server, _("Celebrations in your honor in %s."), @@ -3356,6 +3364,13 @@ static void update_city_activity(struct city *pcity) _("Celebrations canceled in %s."), city_link(pcity)); } + + /* Update city's celebrating counters */ + city_counters_iterate(pcount) { + if (pcount->type == CB_CITY_CELEBRATION_TURNS) { + pcity->counter_values[pcount->index] = 0; + } + } city_counters_iterate_end; pcity->rapture = 0; } pcity->was_happy = is_happy; -- 2.38.1