OSDN Git Service

[Refactor] BIT演算マクロへの置換を進める。display-player-stat-info.c
authordis- <dis.rogue@gmail.com>
Mon, 1 Mar 2021 14:55:54 +0000 (23:55 +0900)
committerdis- <dis.rogue@gmail.com>
Mon, 1 Mar 2021 14:58:50 +0000 (23:58 +0900)
可読性向上のため、BIT演算マクロを使用する。
動作変更は行わない。

src/view/display-player-stat-info.c

index 1baaa5c..55fb0e8 100644 (file)
@@ -231,9 +231,9 @@ static int compensation_stat_by_mutation(player_type *creature_ptr, int stat)
 {
     int compensation = 0;
     if (stat == A_STR) {
-        if (creature_ptr->muta3 & MUT3_HYPER_STR)
+        if (any_bits(creature_ptr->muta3, MUT3_HYPER_STR))
             compensation += 4;
-        if (creature_ptr->muta3 & MUT3_PUNY)
+        if (any_bits(creature_ptr->muta3, MUT3_PUNY))
             compensation -= 4;
         if (creature_ptr->tsuyoshi)
             compensation += 4;
@@ -241,31 +241,31 @@ static int compensation_stat_by_mutation(player_type *creature_ptr, int stat)
     }
 
     if (stat == A_WIS || stat == A_INT) {
-        if (creature_ptr->muta3 & MUT3_HYPER_INT)
+        if (any_bits(creature_ptr->muta3, MUT3_HYPER_INT))
             compensation += 4;
-        if (creature_ptr->muta3 & MUT3_MORONIC)
+        if (any_bits(creature_ptr->muta3, MUT3_MORONIC))
             compensation -= 4;
         return compensation;
     }
 
     if (stat == A_DEX) {
-        if (creature_ptr->muta3 & MUT3_IRON_SKIN)
+        if (any_bits(creature_ptr->muta3, MUT3_IRON_SKIN))
             compensation -= 1;
-        if (creature_ptr->muta3 & MUT3_LIMBER)
+        if (any_bits(creature_ptr->muta3, MUT3_LIMBER))
             compensation += 3;
-        if (creature_ptr->muta3 & MUT3_ARTHRITIS)
+        if (any_bits(creature_ptr->muta3, MUT3_ARTHRITIS))
             compensation -= 3;
         return compensation;
     }
 
     if (stat == A_CON) {
-        if (creature_ptr->muta3 & MUT3_RESILIENT)
+        if (any_bits(creature_ptr->muta3, MUT3_RESILIENT))
             compensation += 4;
-        if (creature_ptr->muta3 & MUT3_XTRA_FAT)
+        if (any_bits(creature_ptr->muta3, MUT3_XTRA_FAT))
             compensation += 2;
-        if (creature_ptr->muta3 & MUT3_ALBINO)
+        if (any_bits(creature_ptr->muta3, MUT3_ALBINO))
             compensation -= 4;
-        if (creature_ptr->muta3 & MUT3_FLESH_ROT)
+        if (any_bits(creature_ptr->muta3, MUT3_FLESH_ROT))
             compensation -= 2;
         if (creature_ptr->tsuyoshi)
             compensation += 4;
@@ -273,17 +273,17 @@ static int compensation_stat_by_mutation(player_type *creature_ptr, int stat)
     }
 
     if (stat == A_CHR) {
-        if (creature_ptr->muta3 & MUT3_SILLY_VOI)
+        if (any_bits(creature_ptr->muta3, MUT3_SILLY_VOI))
             compensation -= 4;
-        if (creature_ptr->muta3 & MUT3_BLANK_FAC)
+        if (any_bits(creature_ptr->muta3, MUT3_BLANK_FAC))
             compensation -= 1;
-        if (creature_ptr->muta3 & MUT3_FLESH_ROT)
+        if (any_bits(creature_ptr->muta3, MUT3_FLESH_ROT))
             compensation -= 1;
-        if (creature_ptr->muta3 & MUT3_SCALES)
+        if (any_bits(creature_ptr->muta3, MUT3_SCALES))
             compensation -= 1;
-        if (creature_ptr->muta3 & MUT3_WART_SKIN)
+        if (any_bits(creature_ptr->muta3, MUT3_WART_SKIN))
             compensation -= 2;
-        if (creature_ptr->muta3 & MUT3_ILL_NORM)
+        if (any_bits(creature_ptr->muta3, MUT3_ILL_NORM))
             compensation = 0;
         return compensation;
     }