From e011d36fcf6c67e4e24bf2c28871255d56271d13 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Sat, 17 Apr 2021 04:24:44 +0300 Subject: [PATCH 46/46] Rulesave: Save comment about civstyle.gameloss_style setting See osdn #42018 Signed-off-by: Marko Lindqvist --- data/ruledit/comments-3.2.txt | 11 +++++++++++ tools/ruleutil/comments.c | 12 ++++++++++++ tools/ruleutil/comments.h | 1 + tools/ruleutil/rulesave.c | 2 ++ 4 files changed, 26 insertions(+) diff --git a/data/ruledit/comments-3.2.txt b/data/ruledit/comments-3.2.txt index 374a40ccc1..7ad71aa60b 100644 --- a/data/ruledit/comments-3.2.txt +++ b/data/ruledit/comments-3.2.txt @@ -1200,3 +1200,14 @@ granary = "\n\ ; city_granary_size = (granary_food_ini[num_inis] +\n\ ; granary_food_inc * (city_size - num_inis)) * foodbox / 100\ " + +gameloss_style = "\n\ +; Comma separated list of things to happen, in addition to death\n\ +; of owner, when gameloss unit dies\n\ +; \"CivilWar\" - Part of the empire remains, controlled by a new player\n\ +; \"Barbarians\" - Depending on if there`s also \"CivilWar\", all or part\n\ +; or half of the dead players empire gets under barbarian\n\ +; control.\n\ +; \"Loot\" - Player who killed the gameloss unit gets loot:\n\ +; Partial map, gold, techs, cities\ +" diff --git a/tools/ruleutil/comments.c b/tools/ruleutil/comments.c index b554c70a71..dcb53b6573 100644 --- a/tools/ruleutil/comments.c +++ b/tools/ruleutil/comments.c @@ -53,6 +53,7 @@ static struct { /* Comment entries */ char *civstyle_granary; + char *civstyle_gameloss_style; } comments_storage; /**********************************************************************//** @@ -126,6 +127,8 @@ bool comments_load(void) comment_load(comments_storage.civstyle_granary, comment_file, "entrydoc.granary"); + comment_load(comments_storage.civstyle_gameloss_style, comment_file, + "entrydoc.gameloss_style"); secfile_check_unused(comment_file); secfile_destroy(comment_file); @@ -385,3 +388,12 @@ void comment_civstyle_granary(struct section_file *sfile) comment_entry_write(sfile, comments_storage.civstyle_granary, "civstyle"); } + +/**********************************************************************//** + Write civstyle gameloss_style settings header. +**************************************************************************/ +void comment_civstyle_gameloss_style(struct section_file *sfile) +{ + comment_entry_write(sfile, comments_storage.civstyle_gameloss_style, + "civstyle"); +} diff --git a/tools/ruleutil/comments.h b/tools/ruleutil/comments.h index 48f887ac76..317f9350b7 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_gameloss_style(struct section_file *sfile); #ifdef __cplusplus } diff --git a/tools/ruleutil/rulesave.c b/tools/ruleutil/rulesave.c index 82dca62097..930143e1f8 100644 --- a/tools/ruleutil/rulesave.c +++ b/tools/ruleutil/rulesave.c @@ -1124,6 +1124,8 @@ static bool save_game_ruleset(const char *filename, const char *name) } if (set_count > 0) { + comment_civstyle_gameloss_style(sfile); + secfile_insert_str_vec(sfile, style_names, set_count, "civstyle.gameloss_style"); } -- 2.30.2