OSDN Git Service

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

index 8afa062..8cefb8d 100644 (file)
@@ -68,8 +68,7 @@ BIT_FLAGS have_xtra_might(player_type *creature_ptr)
 {
     object_type *o_ptr;
     BIT_FLAGS flgs[TR_FLAG_SIZE];
-    BIT_FLAGS result;
-    result = 0L;
+    BIT_FLAGS result = 0L;
 
     for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
         o_ptr = &creature_ptr->inventory_list[i];
@@ -79,22 +78,21 @@ BIT_FLAGS have_xtra_might(player_type *creature_ptr)
         object_flags(creature_ptr, o_ptr, flgs);
 
         if (have_flag(flgs, TR_XTRA_MIGHT))
-            result |= (i - INVEN_RARM);
+            result |= 0x01 << (i - INVEN_RARM);
     }
 
        return result;
 }
 
-void have_esp_evil(player_type *creature_ptr)
+BIT_FLAGS have_esp_evil(player_type *creature_ptr)
 {
     object_type *o_ptr;
     BIT_FLAGS flgs[TR_FLAG_SIZE];
-
-    creature_ptr->esp_evil = FALSE;
+    BIT_FLAGS result = 0L;
 
     if (creature_ptr->realm1 == REALM_HEX) {
         if (hex_spelling(creature_ptr, HEX_DETECT_EVIL))
-            creature_ptr->esp_evil = TRUE;
+            result |= 0x01 << FLAG_CAUSE_MAGIC_TIME_EFFECT;
     }
 
     for (inventory_slot_type i = INVEN_RARM; i < INVEN_TOTAL; i++) {
@@ -105,8 +103,10 @@ void have_esp_evil(player_type *creature_ptr)
         object_flags(creature_ptr, o_ptr, flgs);
 
         if (have_flag(flgs, TR_ESP_EVIL))
-            creature_ptr->esp_evil = TRUE;
+            result |= 0x01 << (i - INVEN_RARM);
     }
+
+       return result;
 }
 
 void have_esp_animal(player_type *creature_ptr)
index 27d4ffa..166bea2 100644 (file)
@@ -22,7 +22,7 @@ enum flag_cause {
 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);
-void have_esp_evil(player_type *creature_ptr);
+BIT_FLAGS have_esp_evil(player_type *creature_ptr);
 void have_esp_animal(player_type *creature_ptr);
 void have_esp_undead(player_type *creature_ptr);
 void have_esp_demon(player_type *creature_ptr);
index 0c06c5c..b9d0634 100644 (file)
@@ -308,7 +308,7 @@ void calc_bonuses(player_type *creature_ptr)
     bool old_esp_giant = creature_ptr->esp_giant;
     bool old_esp_dragon = creature_ptr->esp_dragon;
     bool old_esp_human = creature_ptr->esp_human;
-    bool old_esp_evil = creature_ptr->esp_evil;
+    BIT_FLAGS old_esp_evil = creature_ptr->esp_evil;
     bool old_esp_good = creature_ptr->esp_good;
     bool old_esp_nonliving = creature_ptr->esp_nonliving;
     bool old_esp_unique = creature_ptr->esp_unique;
@@ -322,7 +322,7 @@ void calc_bonuses(player_type *creature_ptr)
     creature_ptr->pass_wall = have_pass_wall(creature_ptr);
     creature_ptr->kill_wall = have_kill_wall(creature_ptr);
     creature_ptr->xtra_might = have_xtra_might(creature_ptr);
-    have_esp_evil(creature_ptr);
+    creature_ptr->esp_evil = have_esp_evil(creature_ptr);
     have_esp_animal(creature_ptr);
     have_esp_undead(creature_ptr);
     have_esp_demon(creature_ptr);
index b31248a..bd65bf6 100644 (file)
@@ -425,7 +425,7 @@ typedef struct player_type {
     bool esp_giant;
     bool esp_dragon;
     bool esp_human;
-    bool esp_evil;
+    BIT_FLAGS esp_evil;
     bool esp_good;
     bool esp_nonliving;
     bool esp_unique;