From ef963215f5b2df0dabcaea655c4a9e96114a12eb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C5=82awomir=20Lach?= <slawek@lach.art.pl>
Date: Mon, 16 May 2022 16:42:32 +0200
Subject: [PATCH 1/3] =?UTF-8?q?!OSDN=2044345=20-=20S=C5=82awomir=20Lach=20?=
 =?UTF-8?q?<slawek@lach.art.pl>?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Add (partial?; untested) the possibility of saving city counters

diff --git a/tools/ruleutil/rulesave.c b/tools/ruleutil/rulesave.c
index f16399d91f..4718b75695 100644
--- a/tools/ruleutil/rulesave.c
+++ b/tools/ruleutil/rulesave.c
@@ -21,6 +21,7 @@
 
 /* common */
 #include "achievements.h"
+#include "counters.h"
 #include "game.h"
 #include "government.h"
 #include "map.h"
@@ -1700,6 +1701,21 @@ static bool save_game_ruleset(const char *filename, const char *name)
     }
   }
 
+  sect_idx = 0;
+  city_counters_iterate(pcounter) {
+    char path[512];
+
+    fc_snprintf(path, sizeof(path), "counter_%d", sect_idx++);
+
+    save_name_translation(sfile, &(pcounter->name), path);
+
+    save_default_int(sfile, pcounter->def, 0, path,"default");
+    save_default_int(sfile, pcounter->checkpoint, 0, path,"checkpoint");
+
+    secfile_insert_str(sfile, counter_behaviour_name(pcounter->type), "%s.type", path);
+
+  } city_counters_iterate_end;
+
   locks = FALSE;
   settings_iterate(SSET_ALL, pset) {
     if (setting_locked(pset)) {
-- 
2.36.1

