From 4069f32d7b282697d00cfd921c7f44223914772c Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Sun, 2 May 2021 11:02:11 +0300 Subject: [PATCH 49/49] Rulesave: Save comment about combat_rules.nuke_pop_loss_pct setting See osdn #42139 Signed-off-by: Marko Lindqvist --- data/ruledit/comments-3.2.txt | 7 +++++++ tools/ruleutil/comments.c | 12 ++++++++++++ tools/ruleutil/comments.h | 1 + tools/ruleutil/rulesave.c | 3 +++ 4 files changed, 23 insertions(+) diff --git a/data/ruledit/comments-3.2.txt b/data/ruledit/comments-3.2.txt index 3d238cc2f6..22e741f5e2 100644 --- a/data/ruledit/comments-3.2.txt +++ b/data/ruledit/comments-3.2.txt @@ -1241,3 +1241,10 @@ tired_attack = "\ ; If this is set to FALSE units will attack with full strength even if they\n\ ; have only fractional moves left.\ " + +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\ +; loose population. Any value below 50 means the city can never be\n\ +; destroyed completely using nuclear.\ +" diff --git a/tools/ruleutil/comments.c b/tools/ruleutil/comments.c index 6f4be3cde3..be0af995c9 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_nuke_pop_loss; } comments_storage; /**********************************************************************//** @@ -135,6 +136,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_nuke_pop_loss, comment_file, + "entrydoc.nuke_pop_loss_pct"); secfile_check_unused(comment_file); secfile_destroy(comment_file); @@ -421,3 +424,12 @@ void comment_combat_rules_tired_attack(struct section_file *sfile) comment_entry_write(sfile, comments_storage.combat_rules_tired_attack, "combat_rules"); } + +/**********************************************************************//** + Write combat_rules nuke_pop_loss_pct settings header. +**************************************************************************/ +void comment_combat_rules_nuke_pop_loss(struct section_file *sfile) +{ + comment_entry_write(sfile, comments_storage.combat_rules_nuke_pop_loss, + "combat_rules"); +} diff --git a/tools/ruleutil/comments.h b/tools/ruleutil/comments.h index 2c3a3ebac3..695c4bb332 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_nuke_pop_loss(struct section_file *sfile); #ifdef __cplusplus } diff --git a/tools/ruleutil/rulesave.c b/tools/ruleutil/rulesave.c index 5edf4978bb..5a691f36d0 100644 --- a/tools/ruleutil/rulesave.c +++ b/tools/ruleutil/rulesave.c @@ -1380,6 +1380,9 @@ static bool save_game_ruleset(const char *filename, const char *name) save_default_bool(sfile, game.info.only_killing_makes_veteran, RS_DEFAULT_ONLY_KILLING_VETERAN, "combat_rules.only_killing_makes_veteran", NULL); + if (game.info.nuke_pop_loss_pct != RS_DEFAULT_NUKE_POP_LOSS_PCT) { + comment_combat_rules_nuke_pop_loss(sfile); + } save_default_int(sfile, game.info.nuke_pop_loss_pct, RS_DEFAULT_NUKE_POP_LOSS_PCT, "combat_rules.nuke_pop_loss_pct", NULL); -- 2.30.2