From 9dce0fe5514b5c2abbd938db2f4d2668fb8797a6 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. Add clarify what counter does into each ruleset diff --git a/data/alien/game.ruleset b/data/alien/game.ruleset index 89a5b294e6..cf3fbbcf51 100644 --- a/data/alien/game.ruleset +++ b/data/alien/game.ruleset @@ -1605,6 +1605,23 @@ type = "Vision" [clause_embassy] type = "Embassy" +; /* <-- avoid gettext warnings +;Counter types +; +;name = translatable name as seen by user +;rule_name = (optional) internal name for savegames, rulesets +; etc; if not present, "name" is used for this +; purpose too. Since the name used in savegames must +; not change, if you want to rename an item after a +; ruleset has been released, you should set +; "rule_name" to the original value of "name". +;checkpoint = Trigger value of the counter. When counter`s +; value is at least this much, the "Counter" requirement +; is fulfilled. +;def = Initial value of the counter. +;type = Behavior of the counter: +; "Owned" - Increased each turn, zeroed when city changes owner +; */ <-- avoid gettext warnings [playercolors] background.r = 86 diff --git a/data/civ1/game.ruleset b/data/civ1/game.ruleset index 04f96a356e..b889311e5f 100644 --- a/data/civ1/game.ruleset +++ b/data/civ1/game.ruleset @@ -1420,6 +1420,23 @@ type = "Vision" [clause_embassy] type = "Embassy" +; /* <-- avoid gettext warnings +;Counter types +; +;name = translatable name as seen by user +;rule_name = (optional) internal name for savegames, rulesets +; etc; if not present, "name" is used for this +; purpose too. Since the name used in savegames must +; not change, if you want to rename an item after a +; ruleset has been released, you should set +; "rule_name" to the original value of "name". +;checkpoint = Trigger value of the counter. When counter`s +; value is at least this much, the "Counter" requirement +; is fulfilled. +;def = Initial value of the counter. +;type = Behavior of the counter: +; "Owned" - Increased each turn, zeroed when city changes owner +; */ <-- avoid gettext warnings [playercolors] background.r = 86 diff --git a/data/civ2/game.ruleset b/data/civ2/game.ruleset index 613f33ee5d..cdce1454fd 100644 --- a/data/civ2/game.ruleset +++ b/data/civ2/game.ruleset @@ -1665,6 +1665,23 @@ type = "Vision" [clause_embassy] type = "Embassy" +; /* <-- avoid gettext warnings +;Counter types +; +;name = translatable name as seen by user +;rule_name = (optional) internal name for savegames, rulesets +; etc; if not present, "name" is used for this +; purpose too. Since the name used in savegames must +; not change, if you want to rename an item after a +; ruleset has been released, you should set +; "rule_name" to the original value of "name". +;checkpoint = Trigger value of the counter. When counter`s +; value is at least this much, the "Counter" requirement +; is fulfilled. +;def = Initial value of the counter. +;type = Behavior of the counter: +; "Owned" - Increased each turn, zeroed when city changes owner +; */ <-- avoid gettext warnings [playercolors] background.r = 86 diff --git a/data/civ2civ3/game.ruleset b/data/civ2civ3/game.ruleset index ae4467ae65..93d0d83417 100644 --- a/data/civ2civ3/game.ruleset +++ b/data/civ2civ3/game.ruleset @@ -2112,6 +2112,24 @@ type = "Vision" [clause_embassy] type = "Embassy" +; /* <-- avoid gettext warnings +;Counter types +; +;name = translatable name as seen by user +;rule_name = (optional) internal name for savegames, rulesets +; etc; if not present, "name" is used for this +; purpose too. Since the name used in savegames must +; not change, if you want to rename an item after a +; ruleset has been released, you should set +; "rule_name" to the original value of "name". +;checkpoint = Trigger value of the counter. When counter`s +; value is at least this much, the "Counter" requirement +; is fulfilled. +;def = Initial value of the counter. +;type = Behavior of the counter: +; "Owned" - Increased each turn, zeroed when city changes owner +; */ <-- avoid gettext warnings + [playercolors] background.r = 86 background.g = 86 diff --git a/data/classic/game.ruleset b/data/classic/game.ruleset index 782c29ac20..e98962fbb1 100644 --- a/data/classic/game.ruleset +++ b/data/classic/game.ruleset @@ -1911,6 +1911,23 @@ type = "Vision" [clause_embassy] type = "Embassy" +; /* <-- avoid gettext warnings +;Counter types +; +;name = translatable name as seen by user +;rule_name = (optional) internal name for savegames, rulesets +; etc; if not present, "name" is used for this +; purpose too. Since the name used in savegames must +; not change, if you want to rename an item after a +; ruleset has been released, you should set +; "rule_name" to the original value of "name". +;checkpoint = Trigger value of the counter. When counter`s +; value is at least this much, the "Counter" requirement +; is fulfilled. +;def = Initial value of the counter. +;type = Behavior of the counter: +; "Owned" - Increased each turn, zeroed when city changes owner +; */ <-- avoid gettext warnings [playercolors] background.r = 86 diff --git a/data/goldkeep/game.ruleset b/data/goldkeep/game.ruleset index 8fb2cd7f36..20cb4fd44b 100644 --- a/data/goldkeep/game.ruleset +++ b/data/goldkeep/game.ruleset @@ -1994,6 +1994,23 @@ type = "Vision" [clause_embassy] type = "Embassy" +; /* <-- avoid gettext warnings +;Counter types +; +;name = translatable name as seen by user +;rule_name = (optional) internal name for savegames, rulesets +; etc; if not present, "name" is used for this +; purpose too. Since the name used in savegames must +; not change, if you want to rename an item after a +; ruleset has been released, you should set +; "rule_name" to the original value of "name". +;checkpoint = Trigger value of the counter. When counter`s +; value is at least this much, the "Counter" requirement +; is fulfilled. +;def = Initial value of the counter. +;type = Behavior of the counter: +; "Owned" - Increased each turn, zeroed when city changes owner +; */ <-- avoid gettext warnings [playercolors] background.r = 86 diff --git a/data/granularity/game.ruleset b/data/granularity/game.ruleset index 57ef67f45a..d5ae95045a 100644 --- a/data/granularity/game.ruleset +++ b/data/granularity/game.ruleset @@ -877,6 +877,23 @@ name = _("Goods") ; ; */ <-- avoid gettext warnings +; /* <-- avoid gettext warnings +;Counter types +; +;name = translatable name as seen by user +;rule_name = (optional) internal name for savegames, rulesets +; etc; if not present, "name" is used for this +; purpose too. Since the name used in savegames must +; not change, if you want to rename an item after a +; ruleset has been released, you should set +; "rule_name" to the original value of "name". +;checkpoint = Trigger value of the counter. When counter`s +; value is at least this much, the "Counter" requirement +; is fulfilled. +;def = Initial value of the counter. +;type = Behavior of the counter: +; "Owned" - Increased each turn, zeroed when city changes owner +; */ <-- avoid gettext warnings [playercolors] background.r = 86 diff --git a/data/multiplayer/game.ruleset b/data/multiplayer/game.ruleset index d11ec2b4da..067462f38b 100644 --- a/data/multiplayer/game.ruleset +++ b/data/multiplayer/game.ruleset @@ -1872,6 +1872,23 @@ type = "Vision" [clause_embassy] type = "Embassy" +; /* <-- avoid gettext warnings +;Counter types +; +;name = translatable name as seen by user +;rule_name = (optional) internal name for savegames, rulesets +; etc; if not present, "name" is used for this +; purpose too. Since the name used in savegames must +; not change, if you want to rename an item after a +; ruleset has been released, you should set +; "rule_name" to the original value of "name". +;checkpoint = Trigger value of the counter. When counter`s +; value is at least this much, the "Counter" requirement +; is fulfilled. +;def = Initial value of the counter. +;type = Behavior of the counter: +; "Owned" - Increased each turn, zeroed when city changes owner +; */ <-- avoid gettext warnings [playercolors] background.r = 86 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/data/stub/game.ruleset b/data/stub/game.ruleset index 6777db9600..550a5f287c 100644 --- a/data/stub/game.ruleset +++ b/data/stub/game.ruleset @@ -738,6 +738,23 @@ name = _("Goods") ; ; */ <-- avoid gettext warnings +; /* <-- avoid gettext warnings +;Counter types +; +;name = translatable name as seen by user +;rule_name = (optional) internal name for savegames, rulesets +; etc; if not present, "name" is used for this +; purpose too. Since the name used in savegames must +; not change, if you want to rename an item after a +; ruleset has been released, you should set +; "rule_name" to the original value of "name". +;checkpoint = Trigger value of the counter. When counter`s +; value is at least this much, the "Counter" requirement +; is fulfilled. +;def = Initial value of the counter. +;type = Behavior of the counter: +; "Owned" - Increased each turn, zeroed when city changes owner +; */ <-- avoid gettext warnings [playercolors] background.r = 86 diff --git a/data/webperimental/game.ruleset b/data/webperimental/game.ruleset index 9b3fe5b077..a5d8157508 100644 --- a/data/webperimental/game.ruleset +++ b/data/webperimental/game.ruleset @@ -2165,6 +2165,23 @@ type = "Vision" [clause_embassy] type = "Embassy" +; /* <-- avoid gettext warnings +;Counter types +; +;name = translatable name as seen by user +;rule_name = (optional) internal name for savegames, rulesets +; etc; if not present, "name" is used for this +; purpose too. Since the name used in savegames must +; not change, if you want to rename an item after a +; ruleset has been released, you should set +; "rule_name" to the original value of "name". +;checkpoint = Trigger value of the counter. When counter`s +; value is at least this much, the "Counter" requirement +; is fulfilled. +;def = Initial value of the counter. +;type = Behavior of the counter: +; "Owned" - Increased each turn, zeroed when city changes owner +; */ <-- avoid gettext warnings [playercolors] background.r = 86 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..a7a562c8c2 100644 --- a/tools/ruleutil/rulesave.c +++ b/tools/ruleutil/rulesave.c @@ -1738,6 +1738,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.3