From dfe4cc9224c1a77f16e7fb5e4f3976c61f2c60d9 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Wed, 13 Oct 2021 05:16:21 +0300 Subject: [PATCH 51/51] Rulesave: Save comment about culture migration_pml settings See osdn #43023 Signed-off-by: Marko Lindqvist --- data/ruledit/comments-3.2.txt | 6 ++++++ tools/ruleutil/comments.c | 11 +++++++++++ tools/ruleutil/comments.h | 1 + tools/ruleutil/rulesave.c | 3 +++ 4 files changed, 21 insertions(+) diff --git a/data/ruledit/comments-3.2.txt b/data/ruledit/comments-3.2.txt index 93d86f52c1..c1203bdbf7 100644 --- a/data/ruledit/comments-3.2.txt +++ b/data/ruledit/comments-3.2.txt @@ -1390,3 +1390,9 @@ history_interest_pml = "\n\ ; of the same original value more valuable as newer history, as it has\n\ ; gained more interest.\ " + +migration_pml = "\n\ +; How much each culture point affects the migration\n\ +; from/to the city. Each culture point count as this many permilles\n\ +; of a migration point.\ +" diff --git a/tools/ruleutil/comments.c b/tools/ruleutil/comments.c index 3475a7e112..26b59217c9 100644 --- a/tools/ruleutil/comments.c +++ b/tools/ruleutil/comments.c @@ -73,6 +73,7 @@ static struct { char *research_upkeep_style; char *research_free_tech_method; char *culture_history_interest; + char *culture_migration_pml; } comments_storage; /**********************************************************************//** @@ -188,6 +189,8 @@ bool comments_load(void) "entrydoc.free_tech_method"); comment_load(comments_storage.culture_history_interest, comment_file, "entrydoc.history_interest_pml"); + comment_load(comments_storage.culture_migration_pml, comment_file, + "entrydoc.migration_pml"); secfile_check_unused(comment_file); secfile_destroy(comment_file); @@ -628,3 +631,11 @@ void comment_culture_history_interest(struct section_file *sfile) comment_entry_write(sfile, comments_storage.culture_history_interest, "culture"); } +/**********************************************************************//** + Write culture migration_pml settings header. +**************************************************************************/ +void comment_culture_migration_pml(struct section_file *sfile) +{ + comment_entry_write(sfile, comments_storage.culture_migration_pml, + "culture"); +} diff --git a/tools/ruleutil/comments.h b/tools/ruleutil/comments.h index ffccb8ffa8..844417b0b9 100644 --- a/tools/ruleutil/comments.h +++ b/tools/ruleutil/comments.h @@ -76,6 +76,7 @@ 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); void comment_culture_history_interest(struct section_file *sfile); +void comment_culture_migration_pml(struct section_file *sfile); #ifdef __cplusplus } diff --git a/tools/ruleutil/rulesave.c b/tools/ruleutil/rulesave.c index 4c3f91b5ab..71c7095214 100644 --- a/tools/ruleutil/rulesave.c +++ b/tools/ruleutil/rulesave.c @@ -1451,6 +1451,9 @@ static bool save_game_ruleset(const char *filename, const char *name) save_default_int(sfile, game.info.culture_vic_lead, RS_DEFAULT_CULTURE_VIC_LEAD, "culture.victory_lead_pct", NULL); + if (game.info.culture_migration_pml != RS_DEFAULT_CULTURE_MIGRATION_PML) { + comment_culture_migration_pml(sfile); + } save_default_int(sfile, game.info.culture_migration_pml, RS_DEFAULT_CULTURE_MIGRATION_PML, "culture.migration_pml", NULL); -- 2.33.0