From f259093bf3a25ca8c561e9a121a731695d815d4b Mon Sep 17 00:00:00 2001 From: deskull Date: Sun, 23 Aug 2020 14:42:06 +0900 Subject: [PATCH] =?utf8?q?[Refactor]=20#40514=20#40652=20have=5Feasy=5Fspe?= =?utf8?q?ll()=20=E3=82=92=20BIT=5FFLAGS=20=E8=BF=94=E3=82=8A=E5=80=A4?= =?utf8?q?=E6=8C=81=E3=81=A1=E3=81=AB=E4=BB=95=E6=A7=98=E5=A4=89=E6=9B=B4.?= =?utf8?q?=20/=20have=5Feasy=5Fspell()=E3=80=80was=20changed=20specificati?= =?utf8?q?ons=20to=20return=20BIT=5FFLAGS=20value.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/player/player-status-flags.c | 17 ++++------------- src/player/player-status-flags.h | 2 +- src/player/player-status.c | 2 +- src/player/player-status.h | 2 +- 4 files changed, 7 insertions(+), 16 deletions(-) diff --git a/src/player/player-status-flags.c b/src/player/player-status-flags.c index e3d3fb4d7..ed9a436fa 100644 --- a/src/player/player-status-flags.c +++ b/src/player/player-status-flags.c @@ -547,20 +547,11 @@ void have_sh_cold(player_type *creature_ptr) } } -void have_easy_spell(player_type *creature_ptr) +BIT_FLAGS have_easy_spell(player_type *creature_ptr) { - object_type *o_ptr; - BIT_FLAGS flgs[TR_FLAG_SIZE]; - creature_ptr->easy_spell = FALSE; - for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) { - o_ptr = &creature_ptr->inventory_list[i]; - if (!o_ptr->k_idx) - continue; - - object_flags(creature_ptr, o_ptr, flgs); - if (have_flag(flgs, TR_EASY_SPELL)) - creature_ptr->easy_spell = TRUE; - } + BIT_FLAGS result = 0L; + result |= check_equipment_flags(creature_ptr, TR_EASY_SPELL); + return result; } void have_heavy_spell(player_type *creature_ptr) diff --git a/src/player/player-status-flags.h b/src/player/player-status-flags.h index c3c30451b..36af02756 100644 --- a/src/player/player-status-flags.h +++ b/src/player/player-status-flags.h @@ -50,7 +50,7 @@ BIT_FLAGS have_anti_tele(player_type *creature_ptr); void have_sh_fire(player_type *creature_ptr); void have_sh_elec(player_type *creature_ptr); void have_sh_cold(player_type *creature_ptr); -void have_easy_spell(player_type *creature_ptr); +BIT_FLAGS have_easy_spell(player_type *creature_ptr); void have_heavy_spell(player_type *creature_ptr); void have_hold_exp(player_type *creature_ptr); void have_see_inv(player_type *creature_ptr); diff --git a/src/player/player-status.c b/src/player/player-status.c index 57e50a0c8..8187bf803 100644 --- a/src/player/player-status.c +++ b/src/player/player-status.c @@ -349,7 +349,7 @@ void calc_bonuses(player_type *creature_ptr) have_sh_fire(creature_ptr); have_sh_elec(creature_ptr); have_sh_cold(creature_ptr); - have_easy_spell(creature_ptr); + creature_ptr->easy_spell = have_easy_spell(creature_ptr); have_heavy_spell(creature_ptr); have_hold_exp(creature_ptr); have_see_inv(creature_ptr); diff --git a/src/player/player-status.h b/src/player/player-status.h index 0c774e30a..fff576c41 100644 --- a/src/player/player-status.h +++ b/src/player/player-status.h @@ -437,7 +437,7 @@ typedef struct player_type { bool pass_wall; /* Permanent wraithform */ bool kill_wall; BIT_FLAGS dec_mana; - bool easy_spell; + BIT_FLAGS easy_spell; bool heavy_spell; bool warning; bool mighty_throw; -- 2.11.0