OSDN Git Service

[Refactor] #40514 have_warning() を calc_bonuses() から分離. / Separated have_warning...
authordeskull <deskull@users.sourceforge.jp>
Sat, 1 Aug 2020 10:10:30 +0000 (19:10 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Sat, 1 Aug 2020 10:10:30 +0000 (19:10 +0900)
src/player/player-status-flags.c
src/player/player-status-flags.h
src/player/player-status.c

index 8836e39..b2ca403 100644 (file)
@@ -562,3 +562,24 @@ void have_see_nocto(player_type *creature_ptr)
        if (creature_ptr->pclass == CLASS_NINJA)
         creature_ptr->see_nocto = TRUE;
 }
+
+void have_warning(player_type *creature_ptr)
+{
+    object_type *o_ptr;
+    BIT_FLAGS flgs[TR_FLAG_SIZE];
+
+       creature_ptr->warning = FALSE;
+
+    for (int 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_WARNING)) {
+            if (!o_ptr->inscription || !(angband_strchr(quark_str(o_ptr->inscription), '$')))
+                creature_ptr->warning = TRUE;
+        }
+    }
+}
index 9e0805d..de55c6a 100644 (file)
@@ -25,5 +25,6 @@ void have_mighty_throw(player_type *creature_ptr);
 void have_dec_mana(player_type *creature_ptr);
 void have_reflect(player_type *creature_ptr);
 void have_see_nocto(player_type *creature_ptr);
+void have_warning(player_type *creature_ptr);
 
 
index 3b3db4b..b985624 100644 (file)
@@ -605,7 +605,6 @@ static void clear_creature_bonuses(player_type *creature_ptr)
     creature_ptr->sh_cold = FALSE;
     creature_ptr->anti_magic = FALSE;
     creature_ptr->anti_tele = FALSE;
-    creature_ptr->warning = FALSE;
     creature_ptr->immune_acid = FALSE;
     creature_ptr->immune_elec = FALSE;
     creature_ptr->immune_fire = FALSE;
@@ -707,6 +706,7 @@ void calc_bonuses(player_type *creature_ptr)
     have_dec_mana(creature_ptr);
     have_reflect(creature_ptr);
     have_see_nocto(creature_ptr);
+    have_warning(creature_ptr);
 
     calc_race_status(creature_ptr);
 
@@ -4658,10 +4658,6 @@ void calc_equipment_status(player_type *creature_ptr)
             creature_ptr->free_act = TRUE;
         if (have_flag(flgs, TR_HOLD_EXP))
             creature_ptr->hold_exp = TRUE;
-        if (have_flag(flgs, TR_WARNING)) {
-            if (!o_ptr->inscription || !(angband_strchr(quark_str(o_ptr->inscription), '$')))
-                creature_ptr->warning = TRUE;
-        }
 
         if (have_flag(flgs, TR_TELEPORT)) {
             if (object_is_cursed(o_ptr))