OSDN Git Service

empty_hands()の戻り値の意味を記号定数化. 不等号を使っていた部分は論理
authornothere <nothere@0568b783-4c39-0410-ac80-bf13821ea2a2>
Fri, 5 Sep 2003 13:03:35 +0000 (13:03 +0000)
committernothere <nothere@0568b783-4c39-0410-ac80-bf13821ea2a2>
Fri, 5 Sep 2003 13:03:35 +0000 (13:03 +0000)
演算に置き換えた.

src/cmd1.c
src/cmd3.c
src/cmd5.c
src/defines.h
src/files.c
src/racial.c
src/xtra1.c

index 819ecb0..c3767df 100644 (file)
@@ -2174,7 +2174,7 @@ static void py_attack_aux(int y, int x, bool *fear, bool *mdeath, s16b hand, int
                                    m_name);
                        else
                        {
-                               if (!(((p_ptr->pclass == CLASS_MONK) || (p_ptr->pclass == CLASS_FORCETRAINER) || (p_ptr->pclass == CLASS_BERSERKER)) && (empty_hands(TRUE) > 1)))
+                               if (!(((p_ptr->pclass == CLASS_MONK) || (p_ptr->pclass == CLASS_FORCETRAINER) || (p_ptr->pclass == CLASS_BERSERKER)) && (empty_hands(TRUE) & EMPTY_HAND_RARM)))
 #ifdef JP
                        msg_format("%s¤ò¹¶·â¤·¤¿¡£", m_name);
 #else
@@ -2235,7 +2235,7 @@ static void py_attack_aux(int y, int x, bool *fear, bool *mdeath, s16b hand, int
                                vorpal_cut = TRUE;
                        else vorpal_cut = FALSE;
 
-                       if (((p_ptr->pclass == CLASS_MONK) || (p_ptr->pclass == CLASS_FORCETRAINER) || (p_ptr->pclass == CLASS_BERSERKER)) && (empty_hands(TRUE) > 1))
+                       if (((p_ptr->pclass == CLASS_MONK) || (p_ptr->pclass == CLASS_FORCETRAINER) || (p_ptr->pclass == CLASS_BERSERKER)) && (empty_hands(TRUE) & EMPTY_HAND_RARM))
                        {
                                int special_effect = 0, stun_effect = 0, times = 0, max_times;
                                int min_level = 1;
index 37f64c7..beb4776 100644 (file)
@@ -485,7 +485,7 @@ msg_print("
        /* Where is the item now */
        if (slot == INVEN_RARM)
        {
-               if((o_ptr->tval != TV_SHIELD) && (o_ptr->tval != TV_CAPTURE) && (o_ptr->tval != TV_CARD) && (empty_hands(FALSE) & 0x00000001) && ((o_ptr->weight > 99) || (o_ptr->tval == TV_POLEARM)) && (!p_ptr->riding || (p_ptr->pet_extra_flags & PF_RYOUTE)))
+               if ((o_ptr->tval != TV_SHIELD) && (o_ptr->tval != TV_CAPTURE) && (o_ptr->tval != TV_CARD) && (empty_hands(FALSE) & EMPTY_HAND_LARM) && ((o_ptr->weight > 99) || (o_ptr->tval == TV_POLEARM)) && (!p_ptr->riding || (p_ptr->pet_extra_flags & PF_RYOUTE)))
 #ifdef JP
                        act = "¤òξ¼ê¤Ç¹½¤¨¤¿";
 #else
@@ -679,7 +679,7 @@ void kamaenaoshi(int item)
                        msg_format("You are wielding %s with two-handed.", o_name );
 #endif
        }
-       else if ((item == INVEN_LARM) && !(empty_hands(FALSE) & 0x0002))
+       else if ((item == INVEN_LARM) && !(empty_hands(FALSE) & EMPTY_HAND_RARM))
        {
                o_ptr = &inventory[INVEN_LARM];
                o2_ptr = &inventory[INVEN_RARM];
index 2d99986..2539766 100644 (file)
@@ -6072,7 +6072,7 @@ power_desc[num] = "Υ
 
        powers[num++] = PET_NAME;
 
-       if (p_ptr->riding && buki_motteruka(INVEN_RARM) && (empty_hands(FALSE) & 0x00000001) && ((inventory[INVEN_RARM].weight > 99) || (inventory[INVEN_RARM].tval == TV_POLEARM)))
+       if (p_ptr->riding && buki_motteruka(INVEN_RARM) && (empty_hands(FALSE) & EMPTY_HAND_LARM) && ((inventory[INVEN_RARM].weight > 99) || (inventory[INVEN_RARM].tval == TV_POLEARM)))
        {
                if (p_ptr->pet_extra_flags & PF_RYOUTE)
                {
index 60eb946..4da88ac 100644 (file)
 #define ACTION_SING     7
 #define ACTION_HAYAGAKE 8
 
+
+/* Empty hand status */
+#define EMPTY_HAND_NONE 0x0000 /* Both hands are used */
+#define EMPTY_HAND_LARM 0x0001 /* Left hand is empty */
+#define EMPTY_HAND_RARM 0x0002 /* Right hand is empty */
+
 /*** General index values ***/
 
 
index d907449..ccacabe 100644 (file)
@@ -1680,7 +1680,7 @@ static void display_player_middle(void)
                else
                        display_player_one_line(ENTRY_LEFT_HAND2, buf, TERM_L_BLUE);
        }
-       else if ((p_ptr->pclass == CLASS_MONK) && (empty_hands(TRUE) > 1))
+       else if ((p_ptr->pclass == CLASS_MONK) && (empty_hands(TRUE) & EMPTY_HAND_RARM))
        {
                int i;
                if (p_ptr->special_defense & KAMAE_MASK)
@@ -2084,7 +2084,7 @@ static void display_player_various(void)
        for(i = 0; i < 2; i++)
        {
                damage[i] = p_ptr->dis_to_d[i] * 100;
-               if (((p_ptr->pclass == CLASS_MONK) || (p_ptr->pclass == CLASS_FORCETRAINER)) && (empty_hands(TRUE) > 1))
+               if (((p_ptr->pclass == CLASS_MONK) || (p_ptr->pclass == CLASS_FORCETRAINER)) && (empty_hands(TRUE) & EMPTY_HAND_RARM))
                {
                        int level = p_ptr->lev;
                        if (i)
index 791a149..4f3766b 100644 (file)
@@ -989,7 +989,7 @@ static bool cmd_racial_power_aux(s32b command)
                }
                case CLASS_MONK:
                {
-                       if (empty_hands(TRUE) < 2)
+                       if (!(empty_hands(TRUE) & EMPTY_HAND_RARM))
                        {
 #ifdef JP
                                msg_print("ÁǼꤸ¤ã¤Ê¤¤¤È¤Ç¤­¤Þ¤»¤ó¡£");
index 91ab35d..bf53b86 100644 (file)
@@ -3127,14 +3127,14 @@ void calc_bonuses(void)
        /* Base skill -- digging */
        p_ptr->skill_dig = 0;
 
-       if (buki_motteruka(INVEN_RARM) && (empty_hands(FALSE) & 0x00000001) && ((inventory[INVEN_RARM].weight > 99) || (inventory[INVEN_RARM].tval == TV_POLEARM)) && (!p_ptr->riding || (p_ptr->pet_extra_flags & PF_RYOUTE))) p_ptr->ryoute = TRUE;
-       if (((p_ptr->pclass == CLASS_MONK) || (p_ptr->pclass == CLASS_FORCETRAINER) || (p_ptr->pclass == CLASS_BERSERKER)) && (empty_hands(TRUE) == 3) && (!p_ptr->riding || (p_ptr->pet_extra_flags & PF_RYOUTE))) p_ptr->ryoute = TRUE;
+       if (buki_motteruka(INVEN_RARM) && (empty_hands(FALSE) & EMPTY_HAND_LARM) && ((inventory[INVEN_RARM].weight > 99) || (inventory[INVEN_RARM].tval == TV_POLEARM)) && (!p_ptr->riding || (p_ptr->pet_extra_flags & PF_RYOUTE))) p_ptr->ryoute = TRUE;
+       if (((p_ptr->pclass == CLASS_MONK) || (p_ptr->pclass == CLASS_FORCETRAINER) || (p_ptr->pclass == CLASS_BERSERKER)) && (empty_hands(TRUE) == (EMPTY_HAND_RARM | EMPTY_HAND_LARM)) && (!p_ptr->riding || (p_ptr->pet_extra_flags & PF_RYOUTE))) p_ptr->ryoute = TRUE;
        if (buki_motteruka(INVEN_RARM) || !buki_motteruka(INVEN_LARM)) p_ptr->migite = TRUE;
        if (buki_motteruka(INVEN_LARM)) p_ptr->hidarite = TRUE;
 
        if (p_ptr->special_defense & KAMAE_MASK)
        {
-               if (empty_hands(TRUE) < 2)
+               if (!(empty_hands(TRUE) & EMPTY_HAND_RARM))
                {
                        set_action(ACTION_NONE);
                }
@@ -4947,7 +4947,7 @@ void calc_bonuses(void)
                int penalty = 0;
 
                p_ptr->riding_ryoute = FALSE;
-               if (p_ptr->ryoute || !empty_hands(FALSE)) p_ptr->riding_ryoute = TRUE;
+               if (p_ptr->ryoute || (empty_hands(FALSE) == EMPTY_HAND_NONE)) p_ptr->riding_ryoute = TRUE;
 
                if ((p_ptr->pclass == CLASS_BEASTMASTER) || (p_ptr->pclass == CLASS_CAVALRY))
                {
@@ -4965,7 +4965,7 @@ void calc_bonuses(void)
        }
 
        /* Different calculation for monks with empty hands */
-       if (((p_ptr->pclass == CLASS_MONK) || (p_ptr->pclass == CLASS_FORCETRAINER) || (p_ptr->pclass == CLASS_BERSERKER)) && (empty_hands(TRUE) > 1))
+       if (((p_ptr->pclass == CLASS_MONK) || (p_ptr->pclass == CLASS_FORCETRAINER) || (p_ptr->pclass == CLASS_BERSERKER)) && (empty_hands(TRUE) & EMPTY_HAND_RARM))
        {
                int blow_base = p_ptr->lev + adj_dex_blow[p_ptr->stat_ind[A_DEX]];
                p_ptr->num_blow[0] = 0;
@@ -5137,7 +5137,7 @@ void calc_bonuses(void)
                p_ptr->dis_to_d[0] += MAX(bonus_to_d,1);
        }
 
-       if (((p_ptr->pclass == CLASS_MONK) || (p_ptr->pclass == CLASS_FORCETRAINER) || (p_ptr->pclass == CLASS_BERSERKER)) && (empty_hands(TRUE) == 3)) p_ptr->ryoute = FALSE;
+       if (((p_ptr->pclass == CLASS_MONK) || (p_ptr->pclass == CLASS_FORCETRAINER) || (p_ptr->pclass == CLASS_BERSERKER)) && (empty_hands(TRUE) == (EMPTY_HAND_RARM | EMPTY_HAND_LARM))) p_ptr->ryoute = FALSE;
 
        /* Affect Skill -- stealth (bonus one) */
        p_ptr->skill_stl += 1;
@@ -5958,12 +5958,12 @@ void handle_stuff(void)
 
 s16b empty_hands(bool is_monk)
 {
-       s16b kaerichi = 0;
-       if (is_monk && (p_ptr->pclass != CLASS_MONK) && (p_ptr->pclass != CLASS_FORCETRAINER) && (p_ptr->pclass != CLASS_BERSERKER)) return FALSE;
+       s16b status = EMPTY_HAND_NONE;
+       if (is_monk && (p_ptr->pclass != CLASS_MONK) && (p_ptr->pclass != CLASS_FORCETRAINER) && (p_ptr->pclass != CLASS_BERSERKER)) return EMPTY_HAND_NONE;
 
-       if (!(inventory[INVEN_RARM].k_idx)) kaerichi +=2;
-       if (!(inventory[INVEN_LARM].k_idx)) kaerichi +=1;
-       return kaerichi;
+       if (!(inventory[INVEN_RARM].k_idx)) status |= EMPTY_HAND_RARM;
+       if (!(inventory[INVEN_LARM].k_idx)) status |= EMPTY_HAND_LARM;
+       return status;
 }