From a540ae633b0da77c51b333e1be5cb585d6b5b6cb Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Sun, 19 Sep 2021 07:39:23 +0300 Subject: [PATCH 33/33] Rulesave: Save comment about research tech_leakage settings See osdn #42880 Signed-off-by: Marko Lindqvist --- data/ruledit/comments-3.2.txt | 14 ++++++++++++++ tools/ruleutil/comments.c | 12 ++++++++++++ tools/ruleutil/comments.h | 1 + tools/ruleutil/rulesave.c | 1 + 4 files changed, 28 insertions(+) diff --git a/data/ruledit/comments-3.2.txt b/data/ruledit/comments-3.2.txt index 11cffc9d2c..989b108886 100644 --- a/data/ruledit/comments-3.2.txt +++ b/data/ruledit/comments-3.2.txt @@ -1346,3 +1346,17 @@ base_tech_cost = "\n\ ; In other words: used everywhere unless the cost of *all* techs are\n\ ; specified and the tech cost style is \"Experimental+\" or \"Classic+\".\ " + +tech_leakage = "\n\ +; Technology leak from other civilizations\n\ +; \"None\" - No reduction of the technology cost.\n\ +; \"Embassies\" - Technology cost is reduced depending on the number of\n\ +; players which already know the tech and you have an\n\ +; embassy with.\n\ +; \"All Players\" - Technology cost is reduced depending on the number of\n\ +; all players (human, AI and barbarians) which already\n\ +; know the tech.\n\ +; \"Normal Players\" - Technology cost is reduced depending on the number of\n\ +; normal players (human and AI) which already know the\n\ +; tech.\ +" diff --git a/tools/ruleutil/comments.c b/tools/ruleutil/comments.c index e278881d64..ba4f338209 100644 --- a/tools/ruleutil/comments.c +++ b/tools/ruleutil/comments.c @@ -68,6 +68,7 @@ static struct { char *borders_radius_permanent; char *research_tech_cost_style; char *research_base_tech_cost; + char *research_tech_leakage; } comments_storage; /**********************************************************************//** @@ -173,6 +174,8 @@ bool comments_load(void) "entrydoc.tech_cost_style"); comment_load(comments_storage.research_base_tech_cost, comment_file, "entrydoc.base_tech_cost"); + comment_load(comments_storage.research_tech_leakage, comment_file, + "entrydoc.tech_leakage"); secfile_check_unused(comment_file); secfile_destroy(comment_file); @@ -567,3 +570,12 @@ void comment_research_base_tech_cost(struct section_file *sfile) comment_entry_write(sfile, comments_storage.research_base_tech_cost, "research"); } + +/**********************************************************************//** + Write research tech_leakage settings header. +**************************************************************************/ +void comment_research_tech_leakage(struct section_file *sfile) +{ + comment_entry_write(sfile, comments_storage.research_tech_leakage, + "research"); +} diff --git a/tools/ruleutil/comments.h b/tools/ruleutil/comments.h index 33d725af5b..d7ea3e5998 100644 --- a/tools/ruleutil/comments.h +++ b/tools/ruleutil/comments.h @@ -71,6 +71,7 @@ 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); +void comment_research_tech_leakage(struct section_file *sfile); #ifdef __cplusplus } diff --git a/tools/ruleutil/rulesave.c b/tools/ruleutil/rulesave.c index 0231282ccb..7599c31900 100644 --- a/tools/ruleutil/rulesave.c +++ b/tools/ruleutil/rulesave.c @@ -1429,6 +1429,7 @@ static bool save_game_ruleset(const char *filename, const char *name) save_default_int(sfile, game.info.base_tech_cost, RS_DEFAULT_BASE_TECH_COST, "research.base_tech_cost", NULL); + comment_research_tech_leakage(sfile); secfile_insert_str(sfile, tech_leakage_style_name(game.info.tech_leakage), "research.tech_leakage"); secfile_insert_str(sfile, tech_upkeep_style_name(game.info.tech_upkeep_style), -- 2.33.0