From 566e28b59ba72f835fd79cc4a4d820a0d32ad1e8 Mon Sep 17 00:00:00 2001 From: Sveinung Kvilhaugsvik Date: Wed, 3 Feb 2021 21:09:14 +0100 Subject: [PATCH 10/10] Use action stuct in autohelp for action blocker. Use action struct rather than action id when documenting what actions blocks an action a unit is able to do. See osdn #41456 --- client/helpdata.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/client/helpdata.c b/client/helpdata.c index 2be969b0ae..4e5e4f990f 100644 --- a/client/helpdata.c +++ b/client/helpdata.c @@ -2836,20 +2836,23 @@ char *helptext_unit(char *buf, size_t bufsz, struct player *pplayer, } i = 0; - action_iterate(blocker) { - if (!utype_can_do_action(utype, blocker)) { + action_iterate(blocker_id) { + const struct action *blocker = action_by_number(blocker_id); + + if (!utype_can_do_action(utype, blocker->id)) { /* Can't block since never legal. */ continue; } - if (action_id_would_be_blocked_by(act, blocker)) { - /* action name alone can be MAX_LEN_NAME, leave space for extra characters */ + if (action_would_be_blocked_by(paction, blocker)) { + /* action name alone can be MAX_LEN_NAME, leave space for extra + * characters */ int maxlen = MAX_LEN_NAME + 16; char *quoted = fc_malloc(maxlen); fc_snprintf(quoted, maxlen, /* TRANS: %s is an action that can block another. */ - _("\'%s\'"), action_id_name_translation(blocker)); + _("\'%s\'"), action_name_translation(blocker)); blockers[i] = quoted; i++; -- 2.20.1