OSDN Git Service

[Refactor] #40514 have_two_handed_weapons() を返り値持ちに仕様変更. / have_two_handed_weapons...
authordeskull <deskull@users.sourceforge.jp>
Tue, 18 Aug 2020 16:38:15 +0000 (01:38 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Tue, 18 Aug 2020 16:38:15 +0000 (01:38 +0900)
src/player/player-status-flags.c
src/player/player-status-flags.h
src/player/player-status.c

index 9dbe756..b0b54a6 100644 (file)
@@ -2075,18 +2075,18 @@ bool have_left_hand_weapon(player_type *creature_ptr)
     return has_melee_weapon(creature_ptr, INVEN_LARM);
 }
 
-void have_two_handed_weapons(player_type *creature_ptr)
+bool have_two_handed_weapons(player_type *creature_ptr)
 {
-    creature_ptr->two_handed_weapon = FALSE;
     if (can_two_hands_wielding(creature_ptr)) {
         if (creature_ptr->right_hand_weapon && (empty_hands(creature_ptr, FALSE) == EMPTY_HAND_LARM)
             && object_allow_two_hands_wielding(&creature_ptr->inventory_list[INVEN_RARM])) {
-            creature_ptr->two_handed_weapon = TRUE;
+            return TRUE;
         } else if (creature_ptr->left_hand_weapon && (empty_hands(creature_ptr, FALSE) == EMPTY_HAND_RARM)
             && object_allow_two_hands_wielding(&creature_ptr->inventory_list[INVEN_LARM])) {
-            creature_ptr->two_handed_weapon = TRUE;
+            return TRUE;
         }
     }
+    return FALSE;
 }
 
 void have_lite(player_type *creature_ptr)
index 8e6c3bb..db79411 100644 (file)
@@ -73,7 +73,7 @@ void have_immune_fire(player_type *creature_ptr);
 void have_immune_cold(player_type *creature_ptr);
 bool have_right_hand_weapon(player_type *creature_ptr);
 bool have_left_hand_weapon(player_type *creature_ptr);
-void have_two_handed_weapons(player_type *creature_ptr);
+bool have_two_handed_weapons(player_type *creature_ptr);
 void have_lite(player_type *creature_ptr);
 bool is_disable_two_handed_bonus(player_type *creature_ptr, int i);
 bool is_not_ninja_weapon(player_type *creature_ptr, int i);
index 60292dc..8fe4ff0 100644 (file)
@@ -324,7 +324,7 @@ void calc_bonuses(player_type *creature_ptr)
 
     creature_ptr->right_hand_weapon = have_right_hand_weapon(creature_ptr);
     creature_ptr->left_hand_weapon = have_left_hand_weapon(creature_ptr);
-    have_two_handed_weapons(creature_ptr);
+    creature_ptr->two_handed_weapon = have_two_handed_weapons(creature_ptr);
     creature_ptr->hold = calc_weapon_weight_limit(creature_ptr);
 
     creature_ptr->pass_wall = have_pass_wall(creature_ptr);