From 256c2273b17853c808aceeb6e163c50d651fece2 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Wed, 2 Jun 2021 03:13:10 +0300 Subject: [PATCH 46/46] Rulesave: Save comment about civstyle.ransom_gold See osdn #42452 Signed-off-by: Marko Lindqvist --- data/ruledit/comments-3.2.txt | 6 ++++++ tools/ruleutil/comments.c | 12 ++++++++++++ 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 de6e8e563c..ed86423418 100644 --- a/data/ruledit/comments-3.2.txt +++ b/data/ruledit/comments-3.2.txt @@ -1201,6 +1201,12 @@ granary = "\n\ ; granary_food_inc * (city_size - num_inis)) * foodbox / 100\ " +ransom_gold = "\n\ +; Barbarian leader ransom in gold. The ransom is taken from\n\ +; the victim (typically a barbarian player), and it`s possible\n\ +; they cannot pay this in full.\ +" + gameloss_style = "\n\ ; Comma separated list of things to happen, in addition to death\n\ ; of owner, when gameloss unit dies\n\ diff --git a/tools/ruleutil/comments.c b/tools/ruleutil/comments.c index 596076e208..e4d2df41c2 100644 --- a/tools/ruleutil/comments.c +++ b/tools/ruleutil/comments.c @@ -53,6 +53,7 @@ static struct { /* Comment entries */ char *civstyle_granary; + char *civstyle_ransom_gold; char *civstyle_gameloss_style; char *civstyle_gold_upkeep_style; char *wonder_visibility_small_wonders; @@ -134,6 +135,8 @@ bool comments_load(void) comment_load(comments_storage.civstyle_granary, comment_file, "entrydoc.granary"); + comment_load(comments_storage.civstyle_ransom_gold, comment_file, + "entrydoc.ransom_gold"); comment_load(comments_storage.civstyle_gameloss_style, comment_file, "entrydoc.gameloss_style"); comment_load(comments_storage.civstyle_gold_upkeep_style, comment_file, @@ -411,6 +414,15 @@ void comment_civstyle_granary(struct section_file *sfile) "civstyle"); } +/**********************************************************************//** + Write civstyle ransom_gold settings header. +**************************************************************************/ +void comment_civstyle_ransom_gold(struct section_file *sfile) +{ + comment_entry_write(sfile, comments_storage.civstyle_ransom_gold, + "civstyle"); +} + /**********************************************************************//** Write civstyle gameloss_style settings header. **************************************************************************/ diff --git a/tools/ruleutil/comments.h b/tools/ruleutil/comments.h index 0b7d489b87..658b190896 100644 --- a/tools/ruleutil/comments.h +++ b/tools/ruleutil/comments.h @@ -56,6 +56,7 @@ void comment_clauses(struct section_file *sfile); /* Entry comments */ void comment_civstyle_granary(struct section_file *sfile); +void comment_civstyle_ransom_gold(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_wonder_visibility_small_wonders(struct section_file *sfile); diff --git a/tools/ruleutil/rulesave.c b/tools/ruleutil/rulesave.c index fface7b28d..f51b1e49e9 100644 --- a/tools/ruleutil/rulesave.c +++ b/tools/ruleutil/rulesave.c @@ -1153,6 +1153,9 @@ static bool save_game_ruleset(const char *filename, const char *name) save_default_int(sfile, game.info.base_bribe_cost, RS_DEFAULT_BASE_BRIBE_COST, "civstyle.base_bribe_cost", NULL); + if (game.server.ransom_gold != RS_DEFAULT_RANSOM_GOLD) { + comment_civstyle_ransom_gold(sfile); + } save_default_int(sfile, game.server.ransom_gold, RS_DEFAULT_RANSOM_GOLD, "civstyle.ransom_gold", NULL); -- 2.30.2