From 0d70881810db4673f3d474a26806770926f981db 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 3/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..09e885c824 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"
@@ -1647,6 +1648,22 @@ static bool save_game_ruleset(const char *filename, const char *name)
                        "trade.goods_selection");
   }
 
+  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;
+  
+  
   /* Goods */
   comment_goods(sfile);
 
-- 
2.36.1

