OSDN Git Service

[Refactor] #40514 #40652 have_easy2_weapon() を BIT_FLAGS 返り値持ちに仕様変更. / have_easy2_wea...
authordeskull <deskull@users.sourceforge.jp>
Mon, 24 Aug 2020 16:31:19 +0000 (01:31 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Mon, 24 Aug 2020 16:31:19 +0000 (01:31 +0900)
src/player/player-status-flags.c
src/player/player-status-flags.h
src/player/player-status.c
src/player/player-status.h

index b161b4b..e5c9da9 100644 (file)
@@ -215,23 +215,11 @@ BIT_FLAGS have_bless_blade(player_type *creature_ptr)
     return result;
 }
 
-void have_easy2_weapon(player_type *creature_ptr)
+BIT_FLAGS have_easy2_weapon(player_type *creature_ptr)
 {
-    object_type *o_ptr;
-    BIT_FLAGS flgs[TR_FLAG_SIZE];
-
-    creature_ptr->easy_2weapon = 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 (o_ptr->name2 == EGO_2WEAPON)
-            creature_ptr->easy_2weapon = TRUE;
-    }
+    BIT_FLAGS result = 0L;
+    result |= check_equipment_flags(creature_ptr, TR_EASY2_WEAPON);
+    return result;
 }
 
 void have_down_saving(player_type *creature_ptr)
index 85c2772..0dead9b 100644 (file)
@@ -38,7 +38,7 @@ BIT_FLAGS have_esp_nonliving(player_type *creature_ptr);
 BIT_FLAGS have_esp_unique(player_type *creature_ptr);
 BIT_FLAGS have_esp_telepathy(player_type *creature_ptr);
 BIT_FLAGS have_bless_blade(player_type *creature_ptr);
-void have_easy2_weapon(player_type *creature_ptr);
+BIT_FLAGS have_easy2_weapon(player_type *creature_ptr);
 void have_down_saving(player_type *creature_ptr);
 void have_no_ac(player_type *creature_ptr);
 void have_no_flowed(player_type *creature_ptr);
index ce169ec..1c48c63 100644 (file)
@@ -336,7 +336,7 @@ void calc_bonuses(player_type *creature_ptr)
     creature_ptr->esp_unique = have_esp_unique(creature_ptr);
     creature_ptr->telepathy = have_esp_telepathy(creature_ptr);
     creature_ptr->bless_blade = have_bless_blade(creature_ptr);
-    have_easy2_weapon(creature_ptr);
+    creature_ptr->easy_2weapon = have_easy2_weapon(creature_ptr);
     have_down_saving(creature_ptr);
     have_no_ac(creature_ptr);
     creature_ptr->mighty_throw = have_mighty_throw(creature_ptr);
index e4ee668..eb9694e 100644 (file)
@@ -330,7 +330,7 @@ typedef struct player_type {
     bool riding_ryoute; /* Riding weapon */
     bool monlite;
     bool yoiyami;
-    bool easy_2weapon;
+    BIT_FLAGS easy_2weapon;
     bool down_saving;
 
     POSITION cur_lite; /* Radius of lite (if any) */