OSDN Git Service

[Refactor] #40514 has_immune_cold() を BIT_FLAGS 返り値持ちに仕様変更. / has_immune_cold() was...
authordeskull <deskull@users.sourceforge.jp>
Fri, 28 Aug 2020 11:16:44 +0000 (20:16 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Fri, 28 Aug 2020 11:16:44 +0000 (20:16 +0900)
src/player/player-status-flags.c
src/player/player-status-flags.h
src/player/player-status.c
src/player/player-status.h

index fc99df4..f47e57c 100644 (file)
@@ -1559,25 +1559,17 @@ BIT_FLAGS has_immune_fire(player_type *creature_ptr)
     return result;
 }
 
-void has_immune_cold(player_type *creature_ptr)
+BIT_FLAGS has_immune_cold(player_type *creature_ptr)
 {
-    object_type *o_ptr;
-    BIT_FLAGS flgs[TR_FLAG_SIZE];
-    creature_ptr->immune_cold = FALSE;
-    if (creature_ptr->ele_immune) {
+    BIT_FLAGS result = 0L;
+
+       if (creature_ptr->ele_immune) {
         if (creature_ptr->special_defense & DEFENSE_COLD)
-            creature_ptr->immune_cold = TRUE;
+           result |= FLAG_CAUSE_MAGIC_TIME_EFFECT;
     }
 
-    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 (has_flag(flgs, TR_IM_COLD))
-            creature_ptr->immune_cold = TRUE;
-    }
+    result |= check_equipment_flags(creature_ptr, TR_IM_COLD);
+    return result;
 }
 
 bool has_right_hand_weapon(player_type *creature_ptr)
index 2e27e9d..d9b9899 100644 (file)
@@ -91,7 +91,7 @@ void has_resist_fear(player_type *creature_ptr);
 BIT_FLAGS has_immune_acid(player_type *creature_ptr);
 BIT_FLAGS has_immune_elec(player_type *creature_ptr);
 BIT_FLAGS has_immune_fire(player_type *creature_ptr);
-void has_immune_cold(player_type *creature_ptr);
+BIT_FLAGS has_immune_cold(player_type *creature_ptr);
 bool has_right_hand_weapon(player_type *creature_ptr);
 bool has_left_hand_weapon(player_type *creature_ptr);
 bool has_two_handed_weapons(player_type *creature_ptr);
index ed7c6f3..56dea6b 100644 (file)
@@ -370,7 +370,7 @@ void calc_bonuses(player_type *creature_ptr)
     creature_ptr->immune_acid = has_immune_acid(creature_ptr);
     creature_ptr->immune_elec = has_immune_elec(creature_ptr);
     creature_ptr->immune_fire = has_immune_fire(creature_ptr);
-    has_immune_cold(creature_ptr);
+    creature_ptr->immune_cold = has_immune_cold(creature_ptr);
     has_resist_acid(creature_ptr);
     has_resist_elec(creature_ptr);
     has_resist_fire(creature_ptr);
index 3451d2a..b88d1ba 100644 (file)
@@ -369,7 +369,7 @@ typedef struct player_type {
     BIT_FLAGS immune_acid; /* Immunity to acid */
     BIT_FLAGS immune_elec; /* Immunity to lightning */
     BIT_FLAGS immune_fire; /* Immunity to fire */
-    bool immune_cold; /* Immunity to cold */
+    BIT_FLAGS immune_cold; /* Immunity to cold */
 
     bool resist_acid; /* Resist acid */
     bool resist_elec; /* Resist lightning */