From d1c71ab1aba387919ac66834fda710de84cae4ff Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Tue, 7 Sep 2021 02:33:30 +0300 Subject: [PATCH 22/22] Rulesave: Save comment about borders radius_sq_city_permanent settings See osdn #42829 Signed-off-by: Marko Lindqvist --- data/ruledit/comments-3.2.txt | 11 +++++++++++ tools/ruleutil/comments.c | 12 ++++++++++++ tools/ruleutil/comments.h | 1 + tools/ruleutil/rulesave.c | 4 ++++ 4 files changed, 28 insertions(+) diff --git a/data/ruledit/comments-3.2.txt b/data/ruledit/comments-3.2.txt index 24473d2c2a..99a88e5881 100644 --- a/data/ruledit/comments-3.2.txt +++ b/data/ruledit/comments-3.2.txt @@ -1306,3 +1306,14 @@ dc_initial_odds = "\n\ ; diplchance. The initial probability of success is modified by the\n\ ; Action_Odds_Pct effect before the roll happens.\n\ " + +radius_permanent = "\n\ +; Difference between city workable area and area permanently claimed by\n\ +; city (these tiles cannot be stolen by stronger border sources).\n\ +; 0 means exactly city workable area is immune to border stealing.\n\ +; Negative value means outer workable tiles can be stolen; highly negative\n\ +; value (more than max city radius_sq) means any workable tile can be stolen.\n\ +; If City_Radius_Sq is variable, so is the set of locked tiles; this is\n\ +; a squared value, so the radius of the ring of tiles which are workable\n\ +; but not locked (or vice versa) varies but the area is constant.\n\ +" diff --git a/tools/ruleutil/comments.c b/tools/ruleutil/comments.c index 46f57d4c8f..f8d2482620 100644 --- a/tools/ruleutil/comments.c +++ b/tools/ruleutil/comments.c @@ -65,6 +65,7 @@ static struct { char *auto_attack; char *actions_ui_names; char *actions_dc_initial_odds; + char *borders_radius_permanent; } comments_storage; /**********************************************************************//** @@ -164,6 +165,8 @@ bool comments_load(void) "entrydoc.ui_names"); comment_load(comments_storage.actions_dc_initial_odds, comment_file, "entrydoc.dc_initial_odds"); + comment_load(comments_storage.borders_radius_permanent, comment_file, + "entrydoc.radius_permanent"); secfile_check_unused(comment_file); secfile_destroy(comment_file); @@ -531,3 +534,12 @@ void comment_actions_dc_initial_odds(struct section_file *sfile) comment_entry_write(sfile, comments_storage.actions_dc_initial_odds, "actions"); } + +/**********************************************************************//** + Write borders radius_sq_city_permanent settings header. +**************************************************************************/ +void comment_borders_radius_permanent(struct section_file *sfile) +{ + comment_entry_write(sfile, comments_storage.borders_radius_permanent, + "borders"); +} diff --git a/tools/ruleutil/comments.h b/tools/ruleutil/comments.h index d2f8513678..336a7f579e 100644 --- a/tools/ruleutil/comments.h +++ b/tools/ruleutil/comments.h @@ -68,6 +68,7 @@ void comment_combat_rules_nuke_defender_survival(struct section_file *sfile); void comment_auto_attack(struct section_file *sfile); 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); #ifdef __cplusplus } diff --git a/tools/ruleutil/rulesave.c b/tools/ruleutil/rulesave.c index a12dfdd522..f12165e53a 100644 --- a/tools/ruleutil/rulesave.c +++ b/tools/ruleutil/rulesave.c @@ -1412,6 +1412,10 @@ static bool save_game_ruleset(const char *filename, const char *name) save_default_int(sfile, game.info.border_size_effect, RS_DEFAULT_BORDER_SIZE_EFFECT, "borders.size_effect", NULL); + if (game.info.border_city_permanent_radius_sq + != RS_DEFAULT_BORDER_RADIUS_SQ_CITY_PERMANENT) { + comment_borders_radius_permanent(sfile); + } save_default_int(sfile, game.info.border_city_permanent_radius_sq, RS_DEFAULT_BORDER_RADIUS_SQ_CITY_PERMANENT, "borders.radius_sq_city_permanent", NULL); -- 2.33.0