From 5ca7e98e7dd365b993536a7c418d0c92a0e53668 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C5=82awomir=20Lach?= <slawek@lach.art.pl>
Date: Tue, 27 Sep 2022 15:09:47 +0200
Subject: [PATCH 1/2] =?UTF-8?q?OSDN=20!#45489:=20S=C5=82awomir=20Lach=20<s?=
 =?UTF-8?q?lawek@lach.art.pl>?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Implements support for counter counting how much turn (one after other)
city is in disorder state. It is only code.

diff --git a/common/fc_types.h b/common/fc_types.h
index 837f5f277f..5a7029fef3 100644
--- a/common/fc_types.h
+++ b/common/fc_types.h
@@ -100,6 +100,8 @@ enum output_type_id {
 #define SPECENUM_VALUE1NAME "Owned"
 #define SPECENUM_VALUE2 CB_CITY_CELEBRATION_TURNS
 #define SPECENUM_VALUE2NAME "Celebration"
+#define SPECENUM_VALUE3 CB_CITY_DISORDER_TURNS
+#define SPECENUM_VALUE3NAME "Disorder"
 
 #define SPECENUM_COUNT COUNTER_BEHAVIOUR_LAST
 #include "specenum_gen.h"
diff --git a/server/srv_main.c b/server/srv_main.c
index 5d79565542..9e181b1bbb 100644
--- a/server/srv_main.c
+++ b/server/srv_main.c
@@ -1549,6 +1549,14 @@ static void end_turn(void)
             pcity->counter_values[pcount->index] = 0;
           }
         }
+        if (pcount->type == CB_CITY_DISORDER_TURNS) {
+          if (city_unhappy(pcity)) {
+            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

