From a9a50bf8c1477b39e32e676aec60ef3e963b6dab Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Wed, 16 Jun 2021 14:21:27 +0300 Subject: [PATCH 47/48] Rulesave: Save comment about action ui_name settings See osdn #42538 Signed-off-by: Marko Lindqvist --- data/ruledit/comments-3.2.txt | 8 ++++++++ tools/ruleutil/comments.c | 11 +++++++++++ tools/ruleutil/comments.h | 1 + tools/ruleutil/rulesave.c | 2 ++ 4 files changed, 22 insertions(+) diff --git a/data/ruledit/comments-3.2.txt b/data/ruledit/comments-3.2.txt index 0ef2910ea0..1b8b5d3397 100644 --- a/data/ruledit/comments-3.2.txt +++ b/data/ruledit/comments-3.2.txt @@ -1290,3 +1290,11 @@ auto_attack = "\n\ ; if_attacker - this requirement vector must be true before a unit even\n\ ; considers to auto attack.\ " + +ui_names = "\n\ +; What each action should be called when showing them to the player.\n\ +; The first \%s should be before the mnemonic of the action. A Freeciv client\n\ +; that supports mnemonics will replace it with the in-band signal that marks\n\ +; the following character as a mnemonic in its graphical toolkit.\n\ +; The second \%s marks where extra details should be inserted.\n\ +" diff --git a/tools/ruleutil/comments.c b/tools/ruleutil/comments.c index 4223c0087c..557ae109a5 100644 --- a/tools/ruleutil/comments.c +++ b/tools/ruleutil/comments.c @@ -63,6 +63,7 @@ static struct { char *combat_rules_nuke_pop_loss; char *combat_rules_nuke_defender_survival; char *auto_attack; + char *actions_ui_names; } comments_storage; /**********************************************************************//** @@ -157,6 +158,8 @@ bool comments_load(void) "entrydoc.nuke_defender_survival_chance_pct"); comment_load(comments_storage.auto_attack, comment_file, "entrydoc.auto_attack"); + comment_load(comments_storage.actions_ui_names, comment_file, + "entrydoc.ui_names"); secfile_check_unused(comment_file); secfile_destroy(comment_file); @@ -507,3 +510,11 @@ void comment_auto_attack(struct section_file *sfile) { comment_entry_write(sfile, comments_storage.auto_attack, "auto_attack"); } + +/**********************************************************************//** + Write actions ui_name settings header. +**************************************************************************/ +void comment_actions_ui_names(struct section_file *sfile) +{ + comment_entry_write(sfile, comments_storage.actions_ui_names, "actions"); +} diff --git a/tools/ruleutil/comments.h b/tools/ruleutil/comments.h index 9128ac733c..4b2cdc8c48 100644 --- a/tools/ruleutil/comments.h +++ b/tools/ruleutil/comments.h @@ -66,6 +66,7 @@ void comment_combat_rules_only_killing_veteran(struct section_file *sfile); 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); #ifdef __cplusplus } diff --git a/tools/ruleutil/rulesave.c b/tools/ruleutil/rulesave.c index caf1250c69..5a78c17616 100644 --- a/tools/ruleutil/rulesave.c +++ b/tools/ruleutil/rulesave.c @@ -1334,6 +1334,8 @@ static bool save_game_ruleset(const char *filename, const char *name) RS_DEFAULT_STEAL_MAP_REVEALS_CITIES, "actions.steal_maps_reveals_all_cities", NULL); + comment_actions_ui_names(sfile); + action_iterate(act_id) { struct action *act = action_by_number(act_id); -- 2.30.2