From 1ab43b678c63fa95c33ec00807c4db5765232713 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Sun, 17 Apr 2022 09:28:44 +0300 Subject: [PATCH 44/44] Separate help strings of action target kinds from their name See osdn #44402 Signed-off-by: Marko Lindqvist --- client/helpdata.c | 6 ++---- common/actions.c | 21 +++++++++++++++++++++ common/actions.h | 14 ++++++++------ 3 files changed, 31 insertions(+), 10 deletions(-) diff --git a/client/helpdata.c b/client/helpdata.c index f9929e8005..62b4c536a9 100644 --- a/client/helpdata.c +++ b/client/helpdata.c @@ -2434,8 +2434,7 @@ char *helptext_unit(char *buf, size_t bufsz, struct player *pplayer, _(" %s is done to %s%s%s.\n"), BULLET, sub_target_text, target_adjective, - _(action_target_kind_name( - action_id_get_target_kind(act)))); + action_target_kind_help(action_id_get_target_kind(act))); } if (utype_is_consumed_by_action(paction, utype)) { @@ -4838,8 +4837,7 @@ void helptext_government(char *buf, size_t bufsz, struct player *pplayer, _("%s Makes it impossible to do the action \'%s\'" " to your %s.\n"), BULLET, action_id_name_translation(act), - _(action_target_kind_name( - action_id_get_target_kind(act)))); + action_target_kind_help(action_id_get_target_kind(act))); } } action_iterate_end; diff --git a/common/actions.c b/common/actions.c index f46b831dcc..3bba026f77 100644 --- a/common/actions.c +++ b/common/actions.c @@ -9511,3 +9511,24 @@ bool action_ever_possible(action_id action) { return action_enabler_list_size(action_enablers_for_action(action)) > 0; } + +const char *atk_helpnames[ATK_COUNT] = +{ + N_("individual cities"), /* ATK_CITY */ + N_("individual units"), /* ATK_UNIT */ + N_("unit stacks"), /* ATK_UNITS */ + N_("tiles"), /* ATK_TILE */ + N_("tile extras"), /* ATK_EXTRAS */ + N_("itself") /* ATK_SELF */ +}; + +/**********************************************************************//** + Return description of the action target kind suitable to use + in the helptext. +**************************************************************************/ +const char *action_target_kind_help(enum action_target_kind kind) +{ + fc_assert(kind >= 0 && kind < ATK_COUNT); + + return _(atk_helpnames[kind]); +} diff --git a/common/actions.h b/common/actions.h index c5baa09516..c159959ea8 100644 --- a/common/actions.h +++ b/common/actions.h @@ -29,20 +29,21 @@ extern "C" { #define SPECENUM_COUNT AAK_COUNT #include "specenum_gen.h" +/* When making changes to this, update also atk_helpnames at actions.c */ #define SPECENUM_NAME action_target_kind #define SPECENUM_VALUE0 ATK_CITY -#define SPECENUM_VALUE0NAME N_("individual cities") +#define SPECENUM_VALUE0NAME "individual cities" #define SPECENUM_VALUE1 ATK_UNIT -#define SPECENUM_VALUE1NAME N_("individual units") +#define SPECENUM_VALUE1NAME "individual units" #define SPECENUM_VALUE2 ATK_UNITS -#define SPECENUM_VALUE2NAME N_("unit stacks") +#define SPECENUM_VALUE2NAME "unit stacks" #define SPECENUM_VALUE3 ATK_TILE -#define SPECENUM_VALUE3NAME N_("tiles") +#define SPECENUM_VALUE3NAME "tiles" #define SPECENUM_VALUE4 ATK_EXTRAS -#define SPECENUM_VALUE4NAME N_("tile extras") +#define SPECENUM_VALUE4NAME "tile extras" /* No target except the actor itself. */ #define SPECENUM_VALUE5 ATK_SELF -#define SPECENUM_VALUE5NAME N_("itself") +#define SPECENUM_VALUE5NAME "itself" #define SPECENUM_COUNT ATK_COUNT #include "specenum_gen.h" @@ -730,6 +731,7 @@ enum action_target_kind action_target_kind_default(enum action_result result); bool action_result_legal_target_kind(enum action_result result, enum action_target_kind tgt_kind); +const char *action_target_kind_help(enum action_target_kind kind); const char *action_actor_consuming_always_ruleset_var_name(action_id act); -- 2.35.1