From 3cf8d27491ef293e4fc688143f434a95856853dc Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Sun, 19 Jun 2022 21:25:50 +0300 Subject: [PATCH 42/42] Macrofy action_has_result() See osdn #44688 Signed-off-by: Marko Lindqvist --- common/actions.c | 13 ------------- common/actions.h | 4 ++-- 2 files changed, 2 insertions(+), 15 deletions(-) diff --git a/common/actions.c b/common/actions.c index 07a0cb7f52..27f2bb1946 100644 --- a/common/actions.c +++ b/common/actions.c @@ -1816,19 +1816,6 @@ enum action_battle_kind action_get_battle_kind(const struct action *pact) } } -/**********************************************************************//** - Returns TRUE iff performing the specified action has the specified - result. -**************************************************************************/ -bool action_has_result(const struct action *paction, - enum action_result result) -{ - fc_assert_ret_val(paction, FALSE); - fc_assert_ret_val(action_result_is_valid(result), FALSE); - - return paction->result == result; -} - /**********************************************************************//** Returns TRUE iff the specified action allows the player to provide details in addition to actor and target. Returns FALSE if the action diff --git a/common/actions.h b/common/actions.h index 0269409145..7f3795ac7f 100644 --- a/common/actions.h +++ b/common/actions.h @@ -458,6 +458,8 @@ struct action_enabler bool ruledit_disabled; }; +#define action_has_result(_act_, _res_) ((_act_)->result == (_res_)) + #define enabler_get_action(_enabler_) action_by_number(_enabler_->action) #define SPECLIST_TAG action_enabler @@ -656,8 +658,6 @@ enum action_battle_kind action_get_battle_kind(const struct action *pact); int action_number(const struct action *action); -bool action_has_result(const struct action *paction, - enum action_result result); #define action_has_result_safe(paction, result) \ (paction && action_has_result(paction, result)) #define action_id_has_result_safe(act_id, result) \ -- 2.35.1