From 3b62dfd132b3c4e53ccda710a2b39ee10db306c6 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Mon, 12 Jul 2021 23:48:39 +0300 Subject: [PATCH 31/31] Rulesave: Save comment about action diplchance_initial_odds settings See osdn #42617 Signed-off-by: Marko Lindqvist --- data/ruledit/comments-3.2.txt | 8 ++++++++ tools/ruleutil/comments.c | 12 ++++++++++++ tools/ruleutil/comments.h | 1 + tools/ruleutil/rulesave.c | 1 + 4 files changed, 22 insertions(+) diff --git a/data/ruledit/comments-3.2.txt b/data/ruledit/comments-3.2.txt index 1b8b5d3397..24473d2c2a 100644 --- a/data/ruledit/comments-3.2.txt +++ b/data/ruledit/comments-3.2.txt @@ -1298,3 +1298,11 @@ ui_names = "\n\ ; the following character as a mnemonic in its graphical toolkit.\n\ ; The second \%s marks where extra details should be inserted.\n\ " + +dc_initial_odds = "\n\ +; Some actions have a action dice roll before the action starts where it can\n\ +; fail. The initial probability of success is 100% unless the action appears\n\ +; in the following list. Then the initial probability comes from the setting\n\ +; diplchance. The initial probability of success is modified by the\n\ +; Action_Odds_Pct effect before the roll happens.\n\ +" diff --git a/tools/ruleutil/comments.c b/tools/ruleutil/comments.c index c8c3a737ab..46f57d4c8f 100644 --- a/tools/ruleutil/comments.c +++ b/tools/ruleutil/comments.c @@ -64,6 +64,7 @@ static struct { char *combat_rules_nuke_defender_survival; char *auto_attack; char *actions_ui_names; + char *actions_dc_initial_odds; } comments_storage; /**********************************************************************//** @@ -161,6 +162,8 @@ bool comments_load(void) "entrydoc.auto_attack"); comment_load(comments_storage.actions_ui_names, comment_file, "entrydoc.ui_names"); + comment_load(comments_storage.actions_dc_initial_odds, comment_file, + "entrydoc.dc_initial_odds"); secfile_check_unused(comment_file); secfile_destroy(comment_file); @@ -519,3 +522,12 @@ void comment_actions_ui_names(struct section_file *sfile) { comment_entry_write(sfile, comments_storage.actions_ui_names, "actions"); } + +/**********************************************************************//** + Write actions diplchance_initial_odds settings header. +**************************************************************************/ +void comment_actions_dc_initial_odds(struct section_file *sfile) +{ + comment_entry_write(sfile, comments_storage.actions_dc_initial_odds, + "actions"); +} diff --git a/tools/ruleutil/comments.h b/tools/ruleutil/comments.h index 4b2cdc8c48..d2f8513678 100644 --- a/tools/ruleutil/comments.h +++ b/tools/ruleutil/comments.h @@ -67,6 +67,7 @@ void comment_combat_rules_nuke_pop_loss(struct section_file *sfile); 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); #ifdef __cplusplus } diff --git a/tools/ruleutil/rulesave.c b/tools/ruleutil/rulesave.c index 5a78c17616..a12dfdd522 100644 --- a/tools/ruleutil/rulesave.c +++ b/tools/ruleutil/rulesave.c @@ -1290,6 +1290,7 @@ static bool save_game_ruleset(const char *filename, const char *name) "auto_attack", "if_attacker"); } + comment_actions_dc_initial_odds(sfile); if (!save_bv_actions(sfile, game.info.diplchance_initial_odds, "actions.diplchance_initial_odds")) { return FALSE; -- 2.30.2