OSDN Git Service

[Refactor] #40514 has_sustain_str() を BIT_FLAGS 返り値持ちに仕様変更. / has_sustain_str() was...
authordeskull <deskull@users.sourceforge.jp>
Wed, 26 Aug 2020 16:46:07 +0000 (01:46 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Wed, 26 Aug 2020 16:46:07 +0000 (01:46 +0900)
src/player/player-status-flags.c
src/player/player-status-flags.h
src/player/player-status.c
src/player/player-status.h

index 0974c0a..9527d2f 100644 (file)
@@ -565,36 +565,28 @@ BIT_FLAGS has_free_act(player_type *creature_ptr)
     return result;
 }
 
-void has_sustain_str(player_type *creature_ptr)
+BIT_FLAGS has_sustain_str(player_type *creature_ptr)
 {
-    object_type *o_ptr;
-    BIT_FLAGS flgs[TR_FLAG_SIZE];
-    creature_ptr->sustain_str = FALSE;
-    if (creature_ptr->pclass == CLASS_BERSERKER) {
-        creature_ptr->sustain_str = TRUE;
+    BIT_FLAGS result = 0L;
+
+       if (creature_ptr->pclass == CLASS_BERSERKER) {
+        result |= FLAG_CAUSE_CLASS;
     }
     if (is_specific_player_race(creature_ptr, RACE_HALF_TROLL) || is_specific_player_race(creature_ptr, RACE_HALF_OGRE)
         || is_specific_player_race(creature_ptr, RACE_HALF_GIANT)) {
-                       creature_ptr->sustain_str = TRUE;
+               result |= FLAG_CAUSE_RACE;
     }
 
        if (creature_ptr->ult_res) {
-        creature_ptr->sustain_str = TRUE;
+        result |= FLAG_CAUSE_MAGIC_TIME_EFFECT;
     }
 
        if (creature_ptr->special_defense & KATA_MUSOU) {
-        creature_ptr->sustain_str = TRUE;
+        result |= FLAG_CAUSE_BATTLE_FORM;
     }
 
-    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_SUST_STR))
-            creature_ptr->sustain_str = TRUE;
-    }
+    result |= check_equipment_flags(creature_ptr, TR_SUST_STR);
+    return result;
 }
 
 void has_sustain_int(player_type *creature_ptr)
index d50fca4..9eb88f1 100644 (file)
@@ -57,7 +57,7 @@ BIT_FLAGS has_heavy_spell(player_type *creature_ptr);
 void has_hold_exp(player_type *creature_ptr);
 void has_see_inv(player_type *creature_ptr);
 BIT_FLAGS has_free_act(player_type *creature_ptr);
-void has_sustain_str(player_type *creature_ptr);
+BIT_FLAGS has_sustain_str(player_type *creature_ptr);
 void has_sustain_int(player_type *creature_ptr);
 void has_sustain_wis(player_type *creature_ptr);
 void has_sustain_dex(player_type *creature_ptr);
index 4b9486c..55f2ba1 100644 (file)
@@ -354,7 +354,7 @@ void calc_bonuses(player_type *creature_ptr)
     has_hold_exp(creature_ptr);
     has_see_inv(creature_ptr);
     creature_ptr->free_act = has_free_act(creature_ptr);
-    has_sustain_str(creature_ptr);
+    creature_ptr->sustain_str = has_sustain_str(creature_ptr);
     has_sustain_int(creature_ptr);
     has_sustain_wis(creature_ptr);
     has_sustain_dex(creature_ptr);
index 3bc3f56..0e9e010 100644 (file)
@@ -399,7 +399,7 @@ typedef struct player_type {
     BIT_FLAGS anti_magic; /* Anti-magic */
     BIT_FLAGS anti_tele; /* Prevent teleportation */
 
-    bool sustain_str; /* Keep strength */
+    BIT_FLAGS sustain_str; /* Keep strength */
     bool sustain_int; /* Keep intelligence */
     bool sustain_wis; /* Keep wisdom */
     bool sustain_dex; /* Keep dexterity */