From a8402db9b78e5321b72c6a16f81ea98356fdd7d1 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Thu, 16 Sep 2021 03:28:13 +0300 Subject: [PATCH 30/30] Rulesave: Save comment about research base_tech_cost settings See osdn #42863 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 0767d116e5..11cffc9d2c 100644 --- a/data/ruledit/comments-3.2.txt +++ b/data/ruledit/comments-3.2.txt @@ -1340,3 +1340,9 @@ tech_cost_style = "\ ; where reqs == number of requirement for tech, counted\n\ ; recursively.\ " + +base_tech_cost = "\n\ +; Base research cost. Used in tech cost styles where tech cost is generated.\n\ +; In other words: used everywhere unless the cost of *all* techs are\n\ +; specified and the tech cost style is \"Experimental+\" or \"Classic+\".\ +" diff --git a/tools/ruleutil/comments.c b/tools/ruleutil/comments.c index 5f115f0406..e278881d64 100644 --- a/tools/ruleutil/comments.c +++ b/tools/ruleutil/comments.c @@ -67,6 +67,7 @@ static struct { char *actions_dc_initial_odds; char *borders_radius_permanent; char *research_tech_cost_style; + char *research_base_tech_cost; } comments_storage; /**********************************************************************//** @@ -170,6 +171,8 @@ bool comments_load(void) "entrydoc.radius_permanent"); comment_load(comments_storage.research_tech_cost_style, comment_file, "entrydoc.tech_cost_style"); + comment_load(comments_storage.research_base_tech_cost, comment_file, + "entrydoc.base_tech_cost"); secfile_check_unused(comment_file); secfile_destroy(comment_file); @@ -555,3 +558,12 @@ void comment_research_tech_cost_style(struct section_file *sfile) comment_entry_write(sfile, comments_storage.research_tech_cost_style, "research"); } + +/**********************************************************************//** + Write research base_tech_cost settings header. +**************************************************************************/ +void comment_research_base_tech_cost(struct section_file *sfile) +{ + comment_entry_write(sfile, comments_storage.research_base_tech_cost, + "research"); +} diff --git a/tools/ruleutil/comments.h b/tools/ruleutil/comments.h index bd2a537743..33d725af5b 100644 --- a/tools/ruleutil/comments.h +++ b/tools/ruleutil/comments.h @@ -70,6 +70,7 @@ void comment_actions_ui_names(struct section_file *sfile); void comment_actions_dc_initial_odds(struct section_file *sfile); void comment_borders_radius_permanent(struct section_file *sfile); void comment_research_tech_cost_style(struct section_file *sfile); +void comment_research_base_tech_cost(struct section_file *sfile); #ifdef __cplusplus } diff --git a/tools/ruleutil/rulesave.c b/tools/ruleutil/rulesave.c index 2befd98cb2..0231282ccb 100644 --- a/tools/ruleutil/rulesave.c +++ b/tools/ruleutil/rulesave.c @@ -1423,6 +1423,9 @@ static bool save_game_ruleset(const char *filename, const char *name) comment_research_tech_cost_style(sfile); secfile_insert_str(sfile, tech_cost_style_name(game.info.tech_cost_style), "research.tech_cost_style"); + if (game.info.base_tech_cost != RS_DEFAULT_BASE_TECH_COST) { + comment_research_base_tech_cost(sfile); + } save_default_int(sfile, game.info.base_tech_cost, RS_DEFAULT_BASE_TECH_COST, "research.base_tech_cost", NULL); -- 2.33.0