From 98579089c2c17408e88e18fbde458090d983b5cd Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Sun, 24 Oct 2021 04:41:03 +0300 Subject: [PATCH 54/54] Rulesave: Save comment about calendar fragments settings See osdn #43117 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 4c57a6e066..80801a1ef8 100644 --- a/data/ruledit/comments-3.2.txt +++ b/data/ruledit/comments-3.2.txt @@ -1401,3 +1401,9 @@ migration_pml = "\n\ ; from/to the city. Each culture point count as this many permilles\n\ ; of a migration point.\ " + +calendar_fragments = "\n\ +; How many fragments each year has. In addition to this, \"Turn_Fragments\" effects are\n\ +; needed to control fragment accumulation.\n\ +; Value 0 here disables year advancement by fragment accumulation.\ +" diff --git a/tools/ruleutil/comments.c b/tools/ruleutil/comments.c index c186b608cd..be4dd4cd28 100644 --- a/tools/ruleutil/comments.c +++ b/tools/ruleutil/comments.c @@ -75,6 +75,7 @@ static struct { char *research_free_tech_method; char *culture_history_interest; char *culture_migration_pml; + char *calendar_fragments; } comments_storage; /**********************************************************************//** @@ -194,6 +195,8 @@ bool comments_load(void) "entrydoc.history_interest_pml"); comment_load(comments_storage.culture_migration_pml, comment_file, "entrydoc.migration_pml"); + comment_load(comments_storage.calendar_fragments, comment_file, + "entrydoc.calendar_fragments"); secfile_check_unused(comment_file); secfile_destroy(comment_file); @@ -652,3 +655,12 @@ void comment_culture_migration_pml(struct section_file *sfile) comment_entry_write(sfile, comments_storage.culture_migration_pml, "culture"); } + +/**********************************************************************//** + Write calendar fragments settings header. +**************************************************************************/ +void comment_calendar_fragments(struct section_file *sfile) +{ + comment_entry_write(sfile, comments_storage.calendar_fragments, + "calendar"); +} diff --git a/tools/ruleutil/comments.h b/tools/ruleutil/comments.h index bcbac23ae9..e9bf9c246b 100644 --- a/tools/ruleutil/comments.h +++ b/tools/ruleutil/comments.h @@ -78,6 +78,7 @@ 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); +void comment_calendar_fragments(struct section_file *sfile); #ifdef __cplusplus } diff --git a/tools/ruleutil/rulesave.c b/tools/ruleutil/rulesave.c index 8ba2104d4b..4420271592 100644 --- a/tools/ruleutil/rulesave.c +++ b/tools/ruleutil/rulesave.c @@ -1479,6 +1479,9 @@ static bool save_game_ruleset(const char *filename, const char *name) save_default_int(sfile, game.server.start_year, GAME_DEFAULT_START_YEAR, "calendar.start_year", NULL); + if (game.calendar.calendar_fragments != 0) { + comment_calendar_fragments(sfile); + } save_default_int(sfile, game.calendar.calendar_fragments, 0, "calendar.fragments", NULL); -- 2.33.0