OSDN Git Service

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

index 8cefb8d..4ebcaf2 100644 (file)
@@ -109,12 +109,11 @@ BIT_FLAGS have_esp_evil(player_type *creature_ptr)
        return result;
 }
 
-void have_esp_animal(player_type *creature_ptr)
+BIT_FLAGS have_esp_animal(player_type *creature_ptr)
 {
     object_type *o_ptr;
     BIT_FLAGS flgs[TR_FLAG_SIZE];
-
-    creature_ptr->esp_animal = FALSE;
+    BIT_FLAGS result = 0L;
 
     for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
         o_ptr = &creature_ptr->inventory_list[i];
@@ -124,8 +123,10 @@ void have_esp_animal(player_type *creature_ptr)
         object_flags(creature_ptr, o_ptr, flgs);
 
         if (have_flag(flgs, TR_ESP_ANIMAL))
-            creature_ptr->esp_animal = TRUE;
+            result |= 0x01 << (i - INVEN_RARM);
     }
+
+       return result;
 }
 
 void have_esp_undead(player_type *creature_ptr)
index 166bea2..523098e 100644 (file)
@@ -23,7 +23,7 @@ bool have_pass_wall(player_type *creature_ptr);
 bool have_kill_wall(player_type *creature_ptr);
 BIT_FLAGS have_xtra_might(player_type *creature_ptr);
 BIT_FLAGS have_esp_evil(player_type *creature_ptr);
-void have_esp_animal(player_type *creature_ptr);
+BIT_FLAGS have_esp_animal(player_type *creature_ptr);
 void have_esp_undead(player_type *creature_ptr);
 void have_esp_demon(player_type *creature_ptr);
 void have_esp_orc(player_type *creature_ptr);
index b9d0634..45fef2a 100644 (file)
@@ -300,7 +300,7 @@ void calc_bonuses(player_type *creature_ptr)
 
     /* Save the old vision stuff */
     bool old_telepathy = creature_ptr->telepathy;
-    bool old_esp_animal = creature_ptr->esp_animal;
+    BIT_FLAGS old_esp_animal = creature_ptr->esp_animal;
     bool old_esp_undead = creature_ptr->esp_undead;
     bool old_esp_demon = creature_ptr->esp_demon;
     bool old_esp_orc = creature_ptr->esp_orc;
@@ -323,7 +323,7 @@ void calc_bonuses(player_type *creature_ptr)
     creature_ptr->kill_wall = have_kill_wall(creature_ptr);
     creature_ptr->xtra_might = have_xtra_might(creature_ptr);
     creature_ptr->esp_evil = have_esp_evil(creature_ptr);
-    have_esp_animal(creature_ptr);
+    creature_ptr->esp_animal = have_esp_animal(creature_ptr);
     have_esp_undead(creature_ptr);
     have_esp_demon(creature_ptr);
     have_esp_orc(creature_ptr);
index bd65bf6..700c5cb 100644 (file)
@@ -417,7 +417,7 @@ typedef struct player_type {
     bool hold_exp; /* Resist exp draining */
 
     bool telepathy; /* Telepathy */
-    bool esp_animal;
+    BIT_FLAGS esp_animal;
     bool esp_undead;
     bool esp_demon;
     bool esp_orc;