From ef557c0d4226036dddad806f558eb657522d6304 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Wed, 29 Sep 2021 01:20:44 +0300 Subject: [PATCH 36/36] Rulesave: Save comment about research free_tech_method settings See osdn #42943 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 | 1 + 4 files changed, 21 insertions(+) diff --git a/data/ruledit/comments-3.2.txt b/data/ruledit/comments-3.2.txt index 47bb9f9b77..f41650371f 100644 --- a/data/ruledit/comments-3.2.txt +++ b/data/ruledit/comments-3.2.txt @@ -1370,3 +1370,10 @@ tech_upkeep_style = "\n\ ; / tech_upkeep_divider - tech_upkeep_free\n\ ; \"Cities\" - upkeep is calculated like \"Basic\", but multiplied by number of cities\ " + +free_tech_method = "\n\ +; Method of selecting techs given for free\n\ +; \"Goal\" - Towards player`s goal, random if no goal\n\ +; \"Random\" - Random researchable tech\n\ +; \"Cheapest\" - Cheapest researchable tech, random among equal cost ones\ +" diff --git a/tools/ruleutil/comments.c b/tools/ruleutil/comments.c index c1e8b10007..ea11231564 100644 --- a/tools/ruleutil/comments.c +++ b/tools/ruleutil/comments.c @@ -70,6 +70,7 @@ static struct { char *research_base_tech_cost; char *research_tech_leakage; char *research_upkeep_style; + char *research_free_tech_method; } comments_storage; /**********************************************************************//** @@ -179,6 +180,8 @@ bool comments_load(void) "entrydoc.tech_leakage"); comment_load(comments_storage.research_upkeep_style, comment_file, "entrydoc.tech_upkeep_style"); + comment_load(comments_storage.research_free_tech_method, comment_file, + "entrydoc.free_tech_method"); secfile_check_unused(comment_file); secfile_destroy(comment_file); @@ -591,3 +594,12 @@ void comment_research_upkeep_style(struct section_file *sfile) comment_entry_write(sfile, comments_storage.research_upkeep_style, "research"); } + +/**********************************************************************//** + Write research free_tech_method settings header. +**************************************************************************/ +void comment_research_free_tech_method(struct section_file *sfile) +{ + comment_entry_write(sfile, comments_storage.research_free_tech_method, + "research"); +} diff --git a/tools/ruleutil/comments.h b/tools/ruleutil/comments.h index 213745ecd4..4b88b42926 100644 --- a/tools/ruleutil/comments.h +++ b/tools/ruleutil/comments.h @@ -73,6 +73,7 @@ void comment_research_tech_cost_style(struct section_file *sfile); void comment_research_base_tech_cost(struct section_file *sfile); void comment_research_tech_leakage(struct section_file *sfile); void comment_research_upkeep_style(struct section_file *sfile); +void comment_research_free_tech_method(struct section_file *sfile); #ifdef __cplusplus } diff --git a/tools/ruleutil/rulesave.c b/tools/ruleutil/rulesave.c index ad3752d1b4..1f7ce1652e 100644 --- a/tools/ruleutil/rulesave.c +++ b/tools/ruleutil/rulesave.c @@ -1438,6 +1438,7 @@ static bool save_game_ruleset(const char *filename, const char *name) save_default_int(sfile, game.info.tech_upkeep_divider, RS_DEFAULT_TECH_UPKEEP_DIVIDER, "research.tech_upkeep_divider", NULL); + comment_research_free_tech_method(sfile); secfile_insert_str(sfile, free_tech_method_name(game.info.free_tech_method), "research.free_tech_method"); -- 2.33.0