From efd196b4ae6c851417e14a2cd1779af91c8555b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C5=82awomir=20Lach?= Date: Wed, 13 Jul 2022 15:25:32 +0200 Subject: [PATCH] =?UTF-8?q?!OSDN=2045028=20-=20S=C5=82awomir=20Lach=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added comment telling how to setup counters Added information about counters in comments of game.ruleset. This apply to each ruleset. diff --git a/data/ruledit/comments-3.2.txt b/data/ruledit/comments-3.2.txt index 072e4d145b..b65d0eadfa 100644 --- a/data/ruledit/comments-3.2.txt +++ b/data/ruledit/comments-3.2.txt @@ -1219,6 +1219,26 @@ clauses = "\ ; */ <-- avoid gettext warnings\n\ " +counters = "\n\ +; /* <-- avoid gettext warnings\n\ +;Counter types\n\ +;\n\ +;name = translatable name as seen by user\n\ +;rule_name = (optional) internal name for savegames, rulesets\n\ +; etc; if not present, \"name\" is used for this\n\ +; purpose too. Since the name used in savegames must\n\ +; not change, if you want to rename an item after a\n\ +; ruleset has been released, you should set\n\ +; \"rule_name\" to the original value of \"name\".\n\ +;checkpoint = Trigger value of the counter. When counter`s\n\ +; value is at least this much, the \"Counter\" requirement\n\ +; is fulfilled.\n\ +;def = Initial value of the counter.\n\ +;type = Behavior of the counter:\n\ +; \"Owned\" - Increased each turn, zeroed when city changes owner\n\ +; */ <-- avoid gettext warnings\n\ +" + [sectiondoc] ; This section has comments documenting other sections nations_ruledit = "\n\ diff --git a/tools/ruleutil/comments.c b/tools/ruleutil/comments.c index 9b0fff6af1..63c7334b3b 100644 --- a/tools/ruleutil/comments.c +++ b/tools/ruleutil/comments.c @@ -51,6 +51,7 @@ static struct { char *nationgroups; char *nationsets; char *clauses; + char *counters; /* Other section entries */ char *nations_ruledit; @@ -160,6 +161,8 @@ bool comments_load(void) comment_load(comments_storage.nationsets, comment_file, "typedoc.nationsets"); comment_load(comments_storage.clauses, comment_file, "typedoc.clauses"); + comment_load(comments_storage.counters, comment_file, + "typedoc.counters"); comment_load(comments_storage.nations_ruledit, comment_file, "sectiondoc.nations_ruledit"); @@ -488,6 +491,15 @@ void comment_clauses(struct section_file *sfile) comment_write(sfile, comments_storage.clauses, "Clauses"); } +/**********************************************************************//** + Write counters comment header. +**************************************************************************/ +void comment_counters(struct section_file *sfile) +{ + comment_write(sfile, comments_storage.counters, + "counters"); +} + /**********************************************************************//** Write nations.ruleset [ruledit] section header. **************************************************************************/ 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 b3bc667947..24582cf3b9 100644 --- a/tools/ruleutil/rulesave.c +++ b/tools/ruleutil/rulesave.c @@ -1722,6 +1722,9 @@ static bool save_game_ruleset(const char *filename, const char *name) /* Clauses */ comment_clauses(sfile); + /* Counters */ + comment_counters(sfile); + sect_idx = 0; for (i = 0; i < CLAUSE_COUNT; i++) { struct clause_info *info = clause_info_get(i); -- 2.37.3