From 7041fc94c3e576bd8cf0fc5aa4ded164d767bea0 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Sun, 19 Jun 2022 21:35:21 +0300 Subject: [PATCH 18/18] Macrofy action_has_result() See osdn #44688 Signed-off-by: Marko Lindqvist --- common/actions.c | 14 -------------- common/actions.h | 4 ++-- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/common/actions.c b/common/actions.c index 4d3523a044..2a3e28d4d5 100644 --- a/common/actions.c +++ b/common/actions.c @@ -829,20 +829,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 gen_action result) -{ - fc_assert_ret_val(paction, FALSE); - fc_assert_ret_val(gen_action_is_valid(result), FALSE); - - /* The action result is currently used as the action id. */ - return paction->id == result; -} - /************************************************************************** Returns TRUE iff the specified action is hostile. **************************************************************************/ diff --git a/common/actions.h b/common/actions.h index 5ecdfda4d5..a6ca5e4ef2 100644 --- a/common/actions.h +++ b/common/actions.h @@ -253,6 +253,8 @@ struct action_enabler bool disabled; }; +#define action_has_result(_act_, _res_) ((_act_)->id == (_res_)) + #define enabler_get_action(_enabler_) action_by_number(_enabler_->action) #define SPECLIST_TAG action_enabler @@ -405,8 +407,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 gen_action 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