OSDN Git Service

[Refactor] #40514 #40652 have_esp_nonliving() を BIT_FLAGS 返り値持ちに仕様変更. / have_esp_nonl...
authordeskull <deskull@users.sourceforge.jp>
Sun, 23 Aug 2020 05:01:38 +0000 (14:01 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Sun, 23 Aug 2020 05:01:38 +0000 (14:01 +0900)
src/player/player-status-flags.c
src/player/player-status-flags.h
src/player/player-status.c
src/player/player-status.h

index 43baacb..139be34 100644 (file)
@@ -165,23 +165,11 @@ BIT_FLAGS have_esp_good(player_type *creature_ptr)
     return result;
 }
 
-void have_esp_nonliving(player_type *creature_ptr)
+BIT_FLAGS have_esp_nonliving(player_type *creature_ptr)
 {
-    object_type *o_ptr;
-    BIT_FLAGS flgs[TR_FLAG_SIZE];
-
-    creature_ptr->esp_nonliving = 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_ESP_NONLIVING))
-            creature_ptr->esp_nonliving = TRUE;
-    }
+    BIT_FLAGS result = 0L;
+    result |= check_equipment_flags(creature_ptr, TR_ESP_GOOD);
+    return result;
 }
 
 void have_esp_unique(player_type *creature_ptr)
index fe36f29..19b8bd5 100644 (file)
@@ -32,7 +32,7 @@ BIT_FLAGS have_esp_giant(player_type *creature_ptr);
 BIT_FLAGS have_esp_dragon(player_type *creature_ptr);
 BIT_FLAGS have_esp_human(player_type *creature_ptr);
 BIT_FLAGS have_esp_good(player_type *creature_ptr);
-void have_esp_nonliving(player_type *creature_ptr);
+BIT_FLAGS have_esp_nonliving(player_type *creature_ptr);
 void have_esp_unique(player_type *creature_ptr);
 void have_esp_telepathy(player_type *creature_ptr);
 void have_bless_blade(player_type *creature_ptr);
index 444fce8..336bc22 100644 (file)
@@ -310,7 +310,7 @@ void calc_bonuses(player_type *creature_ptr)
     BIT_FLAGS old_esp_human = creature_ptr->esp_human;
     BIT_FLAGS old_esp_evil = creature_ptr->esp_evil;
     BIT_FLAGS old_esp_good = creature_ptr->esp_good;
-    bool old_esp_nonliving = creature_ptr->esp_nonliving;
+    BIT_FLAGS old_esp_nonliving = creature_ptr->esp_nonliving;
     bool old_esp_unique = creature_ptr->esp_unique;
     bool old_see_inv = creature_ptr->see_inv;
     bool old_mighty_throw = creature_ptr->mighty_throw;
@@ -332,7 +332,7 @@ void calc_bonuses(player_type *creature_ptr)
     creature_ptr->esp_dragon = have_esp_dragon(creature_ptr);
     creature_ptr->esp_human = have_esp_human(creature_ptr);
     creature_ptr->esp_good = have_esp_good(creature_ptr);
-    have_esp_nonliving(creature_ptr);
+    creature_ptr->esp_nonliving = have_esp_nonliving(creature_ptr);
     have_esp_unique(creature_ptr);
     have_esp_telepathy(creature_ptr);
     have_bless_blade(creature_ptr);
index 039c2cc..1de9503 100644 (file)
@@ -427,7 +427,7 @@ typedef struct player_type {
     BIT_FLAGS esp_human;
     BIT_FLAGS esp_evil;
     BIT_FLAGS esp_good;
-    bool esp_nonliving;
+    BIT_FLAGS esp_nonliving;
     bool esp_unique;
 
     bool slow_digest; /* Slower digestion */