From 9aa9c6c1b2a8b621263403b715307591573a792f Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Tue, 11 May 2021 04:28:14 +0300 Subject: [PATCH 52/52] Rulesave: Save comment about combat_rules.only_killing_makes_veteran See osdn #42218 Signed-off-by: Marko Lindqvist --- data/ruledit/comments-3.2.txt | 5 +++++ tools/ruleutil/comments.c | 13 +++++++++++++ tools/ruleutil/comments.h | 1 + tools/ruleutil/rulesave.c | 3 +++ 4 files changed, 22 insertions(+) diff --git a/data/ruledit/comments-3.2.txt b/data/ruledit/comments-3.2.txt index eb328e8d9c..2fb7853178 100644 --- a/data/ruledit/comments-3.2.txt +++ b/data/ruledit/comments-3.2.txt @@ -1242,6 +1242,11 @@ tired_attack = "\ ; have only fractional moves left.\ " +only_killing_makes_veteran = "\n\ +; With some rules it`s possible that neither side of a combat dies.\n\ +; Set this to TRUE if unit should never gain veterancy from such a combat.\ +" + nuke_pop_loss_pct = "\n\ ; Percentage of population lost by a city after nuclear attak. If set to\n\ ; 100 city is destroyed along with all the units. If set to 0 city does not\n\ diff --git a/tools/ruleutil/comments.c b/tools/ruleutil/comments.c index 53a29a0690..a194505965 100644 --- a/tools/ruleutil/comments.c +++ b/tools/ruleutil/comments.c @@ -56,6 +56,7 @@ static struct { char *civstyle_gameloss_style; char *civstyle_gold_upkeep_style; char *combat_rules_tired_attack; + char *combat_rules_only_killing_veteran; char *combat_rules_nuke_pop_loss; char *combat_rules_nuke_defender_survival; } comments_storage; @@ -137,6 +138,8 @@ bool comments_load(void) "entrydoc.gold_upkeep_style"); comment_load(comments_storage.combat_rules_tired_attack, comment_file, "entrydoc.tired_attack"); + comment_load(comments_storage.combat_rules_only_killing_veteran, comment_file, + "entrydoc.only_killing_makes_veteran"); comment_load(comments_storage.combat_rules_nuke_pop_loss, comment_file, "entrydoc.nuke_pop_loss_pct"); comment_load(comments_storage.combat_rules_nuke_defender_survival, @@ -429,6 +432,16 @@ void comment_combat_rules_tired_attack(struct section_file *sfile) "combat_rules"); } +/**********************************************************************//** + Write combat_rules only_killing_makes_veteran settings header. +**************************************************************************/ +void comment_combat_rules_only_killing_veteran(struct section_file *sfile) +{ + comment_entry_write(sfile, + comments_storage.combat_rules_only_killing_veteran, + "combat_rules"); +} + /**********************************************************************//** Write combat_rules nuke_pop_loss_pct settings header. **************************************************************************/ diff --git a/tools/ruleutil/comments.h b/tools/ruleutil/comments.h index a34d0783bc..ee5307b2f7 100644 --- a/tools/ruleutil/comments.h +++ b/tools/ruleutil/comments.h @@ -59,6 +59,7 @@ 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); +void comment_combat_rules_only_killing_veteran(struct section_file *sfile); void comment_combat_rules_nuke_pop_loss(struct section_file *sfile); void comment_combat_rules_nuke_defender_survival(struct section_file *sfile); diff --git a/tools/ruleutil/rulesave.c b/tools/ruleutil/rulesave.c index b4f51f3ad8..7f0dc15bdf 100644 --- a/tools/ruleutil/rulesave.c +++ b/tools/ruleutil/rulesave.c @@ -1377,6 +1377,9 @@ static bool save_game_ruleset(const char *filename, const char *name) save_default_bool(sfile, game.info.tired_attack, RS_DEFAULT_TIRED_ATTACK, "combat_rules.tired_attack", NULL); + if (game.info.only_killing_makes_veteran != RS_DEFAULT_ONLY_KILLING_VETERAN) { + comment_combat_rules_only_killing_veteran(sfile); + } save_default_bool(sfile, game.info.only_killing_makes_veteran, RS_DEFAULT_ONLY_KILLING_VETERAN, "combat_rules.only_killing_makes_veteran", NULL); -- 2.30.2