From d6db69f68a4e2795256485da2e2177819df2b62c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C5=82awomir=20Lach?= <slawek@lach.art.pl>
Date: Mon, 26 Sep 2022 15:12:03 +0200
Subject: [PATCH 1/2] =?UTF-8?q?OSDN=20!Ticket=20#45488=20:=20S=C5=82awomir?=
 =?UTF-8?q?=20Lach=20<slawek@lach.art.pl>?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Ruleset authors can use new counter type, called Celebration. It counts
number of city's celebration turn, one following exactly other.

diff --git a/common/fc_types.h b/common/fc_types.h
index 57ee66479e..837f5f277f 100644
--- a/common/fc_types.h
+++ b/common/fc_types.h
@@ -98,6 +98,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/srv_main.c b/server/srv_main.c
index 3c18dca1e2..5d79565542 100644
--- a/server/srv_main.c
+++ b/server/srv_main.c
@@ -1541,6 +1541,14 @@ static void end_turn(void)
         if (pcount->type == CB_CITY_OWNED_TURNS) {
           pcity->counter_values[pcount->index]++;
         }
+        if (pcount->type == CB_CITY_CELEBRATION_TURNS) {
+          if (pcity->was_happy) {
+            pcity->counter_values[pcount->index]++;
+          }
+          else {
+            pcity->counter_values[pcount->index] = 0;
+          }
+        }
       } city_counters_iterate_end;
     } city_list_iterate_end;
   } players_iterate_end;
-- 
2.37.3

