Author: sveinung Date: Mon Jul 28 11:56:23 2014 New Revision: 25738 URL: http://svn.gna.org/viewcvs/freeciv?rev=25738&view=rev Log: Improve the action UI name getter functions
Change action_get_ui_name() so it will return the name without anything else. Use it for mentioning actions in the generated help. Document that action_prepare_ui_name() can insert the probability of success and a client specific mnemonic. See patch #4986 Modified: trunk/client/helpdata.c trunk/common/actions.c Modified: trunk/client/helpdata.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/helpdata.c?rev=25738&r1=25737&r2=25738&view=diff ============================================================================== --- trunk/client/helpdata.c (original) +++ trunk/client/helpdata.c Mon Jul 28 11:56:23 2014 @@ -3594,7 +3594,7 @@ cat_snprintf(buf, bufsz, _("* Can do the action \'%s\' to some %s.\n"), - action_prepare_ui_name(act, "", ACTPROB_NA), + action_get_ui_name(act), target_kind); break; } @@ -3626,7 +3626,7 @@ if (!vulnerable) { cat_snprintf(buf, bufsz, _("* Immune to the action \'%s\'.\n"), - action_prepare_ui_name(act, "", ACTPROB_NA)); + action_get_ui_name(act)); } } action_iterate_end; if (!has_vet_levels) { @@ -4927,7 +4927,7 @@ cat_snprintf(buf, bufsz, _("* Makes your %s immune to the action \'%s\'.\n"), _(action_target_kind_name(action_get_target_kind(act))), - action_prepare_ui_name(act, "", ACTPROB_NA)); + action_get_ui_name(act)); } } action_iterate_end; Modified: trunk/common/actions.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/common/actions.c?rev=25738&r1=25737&r2=25738&view=diff ============================================================================== --- trunk/common/actions.c (original) +++ trunk/common/actions.c Mon Jul 28 11:56:23 2014 @@ -161,17 +161,18 @@ } /************************************************************************** - Get the raw name used when showning the action in the UI. + Get the action name used when displaying the action in the UI. Nothing + is added to the UI name. **************************************************************************/ const char *action_get_ui_name(int action_id) { - fc_assert_msg(actions[action_id], "Action %d don't exist.", action_id); - - return actions[action_id]->ui_name; -} - -/************************************************************************** - Get the UI name ready to show the action in the UI. + return action_prepare_ui_name(action_id, "", ACTPROB_NA); +} + +/************************************************************************** + Get the UI name ready to show the action in the UI. It is possible to + add a client specific mnemonic. Success probability information is + interpreted and added to the text. **************************************************************************/ const char *action_prepare_ui_name(int action_id, const char* mnemonic, const action_probability prob) @@ -210,7 +211,7 @@ fc_assert_msg(actions[action_id], "Action %d don't exist.", action_id); - astr_set(&str, _(action_get_ui_name(action_id)), mnemonic, + astr_set(&str, _(actions[action_id]->ui_name), mnemonic, astr_str(&chance)); return astr_str(&str); _______________________________________________ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits