From a1d2b5adc74f650f3565a07d411397de20bf4acb Mon Sep 17 00:00:00 2001 From: deskull Date: Mon, 10 Aug 2020 23:17:41 +0900 Subject: [PATCH] =?utf8?q?[Refactor]=20#40514=20have=5Fleft=5Fhand=5Fweapo?= =?utf8?q?n()=20=E3=82=92=20calc=5Fbonuses()=E3=80=80=E3=81=8B=E3=82=89?= =?utf8?q?=E5=88=86=E9=9B=A2=EF=BC=8E=20/=20Separated=20have=5Fleft=5Fhand?= =?utf8?q?=5Fweapon()=20from=20calc=5Fbonuses().?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/player/player-status-flags.c | 8 ++++++++ src/player/player-status-flags.h | 1 + src/player/player-status.c | 3 +-- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/player/player-status-flags.c b/src/player/player-status-flags.c index 9f578c446..2348dccba 100644 --- a/src/player/player-status-flags.c +++ b/src/player/player-status-flags.c @@ -2065,3 +2065,11 @@ void have_right_hand_weapon(player_type *creature_ptr) } } + +void have_left_hand_weapon(player_type *creature_ptr) +{ + creature_ptr->left_hand_weapon = FALSE; + if (has_melee_weapon(creature_ptr, INVEN_LARM)) { + creature_ptr->left_hand_weapon = TRUE; + } +} diff --git a/src/player/player-status-flags.h b/src/player/player-status-flags.h index 442907742..ce6871edf 100644 --- a/src/player/player-status-flags.h +++ b/src/player/player-status-flags.h @@ -72,5 +72,6 @@ void have_immune_elec(player_type *creature_ptr); void have_immune_fire(player_type *creature_ptr); void have_immune_cold(player_type *creature_ptr); void have_right_hand_weapon(player_type *creature_ptr); +void have_left_hand_weapon(player_type *creature_ptr); diff --git a/src/player/player-status.c b/src/player/player-status.c index b9cf287df..bc7c531e8 100644 --- a/src/player/player-status.c +++ b/src/player/player-status.c @@ -561,7 +561,6 @@ static void delayed_visual_update(player_type *player_ptr) static void clear_creature_bonuses(player_type *creature_ptr) { creature_ptr->two_handed_weapon = FALSE; - creature_ptr->left_hand_weapon = FALSE; } /*! @@ -632,9 +631,9 @@ void calc_bonuses(player_type *creature_ptr) clear_creature_bonuses(creature_ptr); have_right_hand_weapon(creature_ptr); + have_left_hand_weapon(creature_ptr); if (has_melee_weapon(creature_ptr, INVEN_LARM)) { - creature_ptr->left_hand_weapon = TRUE; if (!creature_ptr->right_hand_weapon) default_hand = 1; } -- 2.11.0