From 8808fd6d013b0ef29d06d7170fc2ce37d9e130ab Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Thu, 29 Apr 2021 02:50:44 +0300 Subject: [PATCH 42/43] Rulesave: Save comment about combat_rules.tired_attack setting See osdn #42109 Signed-off-by: Marko Lindqvist --- data/alien/game.ruleset | 2 +- data/civ1/game.ruleset | 2 +- data/civ2/game.ruleset | 2 +- data/civ2civ3/game.ruleset | 2 +- data/classic/game.ruleset | 2 +- data/goldkeep/game.ruleset | 2 +- data/granularity/game.ruleset | 2 +- data/multiplayer/game.ruleset | 2 +- data/ruledit/comments-3.2.txt | 9 +++++++++ data/sandbox/game.ruleset | 2 +- data/stub/game.ruleset | 2 +- data/webperimental/game.ruleset | 2 +- tools/ruleutil/comments.c | 12 ++++++++++++ tools/ruleutil/comments.h | 1 + tools/ruleutil/rulesave.c | 3 +++ 15 files changed, 36 insertions(+), 11 deletions(-) diff --git a/data/alien/game.ruleset b/data/alien/game.ruleset index e3dddf37e9..f2a4135776 100644 --- a/data/alien/game.ruleset +++ b/data/alien/game.ruleset @@ -223,7 +223,7 @@ total_factor = 100 [combat_rules] ; If tired_attack is set to TRUE, units that attack with less than a single ; move point (per move_fragments in terrain.ruleset) will have their attack -; power reduced accordingly. For instance, if move_fragments=3, a unit with +; power reduced accordingly. For instance, if move_fragments = 3, a unit with ; 2/3 move points will have attack power 2/3 of normal. ; If this is set to FALSE units will attack with full strength even if they ; have only fractional moves left. diff --git a/data/civ1/game.ruleset b/data/civ1/game.ruleset index d98933293b..0111b18c38 100644 --- a/data/civ1/game.ruleset +++ b/data/civ1/game.ruleset @@ -211,7 +211,7 @@ total_factor = 100 [combat_rules] ; If tired_attack is set to TRUE, units that attack with less than a single ; move point (per move_fragments in terrain.ruleset) will have their attack -; power reduced accordingly. For instance, if move_fragments=3, a unit with +; power reduced accordingly. For instance, if move_fragments = 3, a unit with ; 2/3 move points will have attack power 2/3 of normal. ; If this is set to FALSE units will attack with full strength even if they ; have only fractional moves left. diff --git a/data/civ2/game.ruleset b/data/civ2/game.ruleset index 9d3d7bf2cf..77f071d9da 100644 --- a/data/civ2/game.ruleset +++ b/data/civ2/game.ruleset @@ -207,7 +207,7 @@ total_factor = 100 [combat_rules] ; If tired_attack is set to TRUE, units that attack with less than a single ; move point (per move_fragments in terrain.ruleset) will have their attack -; power reduced accordingly. For instance, if move_fragments=3, a unit with +; power reduced accordingly. For instance, if move_fragments = 3, a unit with ; 2/3 move points will have attack power 2/3 of normal. ; If this is set to FALSE units will attack with full strength even if they ; have only fractional moves left. diff --git a/data/civ2civ3/game.ruleset b/data/civ2civ3/game.ruleset index eae6c7c057..dd0a9a9da1 100644 --- a/data/civ2civ3/game.ruleset +++ b/data/civ2civ3/game.ruleset @@ -229,7 +229,7 @@ total_factor = 100 [combat_rules] ; If tired_attack is set to TRUE, units that attack with less than a single ; move point (per move_fragments in terrain.ruleset) will have their attack -; power reduced accordingly. For instance, if move_fragments=3, a unit with +; power reduced accordingly. For instance, if move_fragments = 3, a unit with ; 2/3 move points will have attack power 2/3 of normal. ; If this is set to FALSE units will attack with full strength even if they ; have only fractional moves left. diff --git a/data/classic/game.ruleset b/data/classic/game.ruleset index b332aaca87..4188347e5d 100644 --- a/data/classic/game.ruleset +++ b/data/classic/game.ruleset @@ -224,7 +224,7 @@ total_factor = 100 [combat_rules] ; If tired_attack is set to TRUE, units that attack with less than a single ; move point (per move_fragments in terrain.ruleset) will have their attack -; power reduced accordingly. For instance, if move_fragments=3, a unit with +; power reduced accordingly. For instance, if move_fragments = 3, a unit with ; 2/3 move points will have attack power 2/3 of normal. ; If this is set to FALSE units will attack with full strength even if they ; have only fractional moves left. diff --git a/data/goldkeep/game.ruleset b/data/goldkeep/game.ruleset index f59254ff52..1fc35fa80e 100644 --- a/data/goldkeep/game.ruleset +++ b/data/goldkeep/game.ruleset @@ -227,7 +227,7 @@ total_factor = 100 [combat_rules] ; If tired_attack is set to TRUE, units that attack with less than a single ; move point (per move_fragments in terrain.ruleset) will have their attack -; power reduced accordingly. For instance, if move_fragments=3, a unit with +; power reduced accordingly. For instance, if move_fragments = 3, a unit with ; 2/3 move points will have attack power 2/3 of normal. ; If this is set to FALSE units will attack with full strength even if they ; have only fractional moves left. diff --git a/data/granularity/game.ruleset b/data/granularity/game.ruleset index 3f26ee9264..1505ca26c8 100644 --- a/data/granularity/game.ruleset +++ b/data/granularity/game.ruleset @@ -219,7 +219,7 @@ total_factor = 100 [combat_rules] ; If tired_attack is set to TRUE, units that attack with less than a single ; move point (per move_fragments in terrain.ruleset) will have their attack -; power reduced accordingly. For instance, if move_fragments=3, a unit with +; power reduced accordingly. For instance, if move_fragments = 3, a unit with ; 2/3 move points will have attack power 2/3 of normal. ; If this is set to FALSE units will attack with full strength even if they ; have only fractional moves left. diff --git a/data/multiplayer/game.ruleset b/data/multiplayer/game.ruleset index 7df73f66e2..471799358a 100644 --- a/data/multiplayer/game.ruleset +++ b/data/multiplayer/game.ruleset @@ -227,7 +227,7 @@ total_factor = 10000 [combat_rules] ; If tired_attack is set to TRUE, units that attack with less than a single ; move point (per move_fragments in terrain.ruleset) will have their attack -; power reduced accordingly. For instance, if move_fragments=3, a unit with +; power reduced accordingly. For instance, if move_fragments = 3, a unit with ; 2/3 move points will have attack power 2/3 of normal. ; If this is set to FALSE units will attack with full strength even if they ; have only fractional moves left. diff --git a/data/ruledit/comments-3.2.txt b/data/ruledit/comments-3.2.txt index 106713bb86..3d238cc2f6 100644 --- a/data/ruledit/comments-3.2.txt +++ b/data/ruledit/comments-3.2.txt @@ -1232,3 +1232,12 @@ gold_upkeep_style = "\n\ ; If still more gold is needed, then random units with gold\n\ ; upkeep are disbanded.\ " + +tired_attack = "\ +; If tired_attack is set to TRUE, units that attack with less than a single\n\ +; move point (per move_fragments in terrain.ruleset) will have their attack\n\ +; power reduced accordingly. For instance, if move_fragments = 3, a unit with\n\ +; 2/3 move points will have attack power 2/3 of normal.\n\ +; If this is set to FALSE units will attack with full strength even if they\n\ +; have only fractional moves left.\ +" diff --git a/data/sandbox/game.ruleset b/data/sandbox/game.ruleset index 27f411b02e..61b1ee4a76 100644 --- a/data/sandbox/game.ruleset +++ b/data/sandbox/game.ruleset @@ -227,7 +227,7 @@ total_factor = 100 [combat_rules] ; If tired_attack is set to TRUE, units that attack with less than a single ; move point (per move_fragments in terrain.ruleset) will have their attack -; power reduced accordingly. For instance, if move_fragments=3, a unit with +; power reduced accordingly. For instance, if move_fragments = 3, a unit with ; 2/3 move points will have attack power 2/3 of normal. ; If this is set to FALSE units will attack with full strength even if they ; have only fractional moves left. diff --git a/data/stub/game.ruleset b/data/stub/game.ruleset index 8f6780d46f..790e7f4e8b 100644 --- a/data/stub/game.ruleset +++ b/data/stub/game.ruleset @@ -211,7 +211,7 @@ total_factor = 100 [combat_rules] ; If tired_attack is set to TRUE, units that attack with less than a single ; move point (per move_fragments in terrain.ruleset) will have their attack -; power reduced accordingly. For instance, if move_fragments=3, a unit with +; power reduced accordingly. For instance, if move_fragments = 3, a unit with ; 2/3 move points will have attack power 2/3 of normal. ; If this is set to FALSE units will attack with full strength even if they ; have only fractional moves left. diff --git a/data/webperimental/game.ruleset b/data/webperimental/game.ruleset index 945aec28f7..fec158fe62 100644 --- a/data/webperimental/game.ruleset +++ b/data/webperimental/game.ruleset @@ -228,7 +228,7 @@ total_factor = 100 [combat_rules] ; If tired_attack is set to TRUE, units that attack with less than a single ; move point (per move_fragments in terrain.ruleset) will have their attack -; power reduced accordingly. For instance, if move_fragments=3, a unit with +; power reduced accordingly. For instance, if move_fragments = 3, a unit with ; 2/3 move points will have attack power 2/3 of normal. ; If this is set to FALSE units will attack with full strength even if they ; have only fractional moves left. diff --git a/tools/ruleutil/comments.c b/tools/ruleutil/comments.c index c84f815e4f..6f4be3cde3 100644 --- a/tools/ruleutil/comments.c +++ b/tools/ruleutil/comments.c @@ -55,6 +55,7 @@ static struct { char *civstyle_granary; char *civstyle_gameloss_style; char *civstyle_gold_upkeep_style; + char *combat_rules_tired_attack; } comments_storage; /**********************************************************************//** @@ -132,6 +133,8 @@ bool comments_load(void) "entrydoc.gameloss_style"); comment_load(comments_storage.civstyle_gold_upkeep_style, comment_file, "entrydoc.gold_upkeep_style"); + comment_load(comments_storage.combat_rules_tired_attack, comment_file, + "entrydoc.tired_attack"); secfile_check_unused(comment_file); secfile_destroy(comment_file); @@ -409,3 +412,12 @@ void comment_civstyle_gold_upkeep_style(struct section_file *sfile) comment_entry_write(sfile, comments_storage.civstyle_gold_upkeep_style, "civstyle"); } + +/**********************************************************************//** + Write combat_rules tired_attack settings header. +**************************************************************************/ +void comment_combat_rules_tired_attack(struct section_file *sfile) +{ + comment_entry_write(sfile, comments_storage.combat_rules_tired_attack, + "combat_rules"); +} diff --git a/tools/ruleutil/comments.h b/tools/ruleutil/comments.h index 71159abe33..2c3a3ebac3 100644 --- a/tools/ruleutil/comments.h +++ b/tools/ruleutil/comments.h @@ -58,6 +58,7 @@ void comment_clauses(struct section_file *sfile); void comment_civstyle_granary(struct section_file *sfile); void comment_civstyle_gameloss_style(struct section_file *sfile); void comment_civstyle_gold_upkeep_style(struct section_file *sfile); +void comment_combat_rules_tired_attack(struct section_file *sfile); #ifdef __cplusplus } diff --git a/tools/ruleutil/rulesave.c b/tools/ruleutil/rulesave.c index d2b6c2ddda..5edf4978bb 100644 --- a/tools/ruleutil/rulesave.c +++ b/tools/ruleutil/rulesave.c @@ -1371,6 +1371,9 @@ static bool save_game_ruleset(const char *filename, const char *name) save_reqs_vector(sfile, &(pae->target_reqs), path, "target_reqs"); } action_enablers_iterate_end; + if (game.info.tired_attack != RS_DEFAULT_TIRED_ATTACK) { + comment_combat_rules_tired_attack(sfile); + } save_default_bool(sfile, game.info.tired_attack, RS_DEFAULT_TIRED_ATTACK, "combat_rules.tired_attack", NULL); -- 2.30.2