From f86235642a0a31b04a6943798d0d2f7340351d66 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C5=82awomir=20Lach?= <slawek@lach.art.pl>
Date: Wed, 13 Jul 2022 15:25:32 +0200
Subject: [PATCH 1/2] =?UTF-8?q?!OSDN=2045028=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

- Added comment of counters saving into game.ruleset

diff --git a/tools/ruleutil/comments.c b/tools/ruleutil/comments.c
index 9b0fff6af1..6b2219892d 100644
--- a/tools/ruleutil/comments.c
+++ b/tools/ruleutil/comments.c
@@ -88,6 +88,7 @@ static struct {
   char *culture_history_interest;
   char *culture_migration_pml;
   char *calendar_fragments;
+  char *counters;
 } comments_storage;
 
 /**********************************************************************//**
@@ -229,6 +230,8 @@ bool comments_load(void)
                "entrydoc.migration_pml");
   comment_load(comments_storage.calendar_fragments, comment_file,
                "entrydoc.calendar_fragments");
+  comment_load(comments_storage.counters, comment_file,
+               "entrydoc.counters");
 
   secfile_check_unused(comment_file);
   secfile_destroy(comment_file);
@@ -789,3 +792,12 @@ void comment_calendar_fragments(struct section_file *sfile)
   comment_entry_write(sfile, comments_storage.calendar_fragments,
                       "calendar");
 }
+
+/**********************************************************************//**
+  Write counters comment header.
+**************************************************************************/
+void comment_counters(struct section_file *sfile)
+{
+  comment_entry_write(sfile, comments_storage.counters,
+                      "counters");
+}
diff --git a/tools/ruleutil/comments.h b/tools/ruleutil/comments.h
index 0a33711a8d..6f20dccb67 100644
--- a/tools/ruleutil/comments.h
+++ b/tools/ruleutil/comments.h
@@ -91,6 +91,7 @@ void comment_research_free_tech_method(struct section_file *sfile);
 void comment_culture_history_interest(struct section_file *sfile);
 void comment_culture_migration_pml(struct section_file *sfile);
 void comment_calendar_fragments(struct section_file *sfile);
+void comment_counters(struct section_file *sfile);
 
 #ifdef __cplusplus
 }
diff --git a/tools/ruleutil/rulesave.c b/tools/ruleutil/rulesave.c
index 5c56e07061..acd17bd67a 100644
--- a/tools/ruleutil/rulesave.c
+++ b/tools/ruleutil/rulesave.c
@@ -1725,6 +1725,9 @@ static bool save_game_ruleset(const char *filename, const char *name)
     }
   }
 
+  /* Counters */
+  comment_counters(sfile);
+  
   sect_idx = 0;
   city_counters_iterate(pcounter) {
     char path[512];
-- 
2.37.0

