OSDN Git Service

[Refactor] #37287 #37353 型の置換。 / Type replacement.
[hengband/hengband.git] / src / melee1.c
index f0b1425..8b41721 100644 (file)
@@ -25,7 +25,7 @@
  * @return 命中と判定された場合TRUEを返す
  * @note Always miss 5%, always hit 5%, otherwise random.
  */
-bool test_hit_norm(int chance, int ac, int vis)
+bool test_hit_norm(int chance, ARMOUR_CLASS ac, int vis)
 {
        int k;
 
@@ -62,7 +62,7 @@ bool test_hit_norm(int chance, int ac, int vis)
 * @param mode オプションフラグ
 * @return クリティカル修正が入ったダメージ値
 */
-HIT_POINT critical_norm(int weight, int plus, HIT_POINT dam, s16b meichuu, BIT_FLAGS mode)
+HIT_POINT critical_norm(WEIGHT weight, int plus, HIT_POINT dam, s16b meichuu, BIT_FLAGS mode)
 {
        int i, k;
 
@@ -116,7 +116,7 @@ HIT_POINT critical_norm(int weight, int plus, HIT_POINT dam, s16b meichuu, BIT_F
  * and which also do at least 20 damage, or, sometimes, N damage.
  * This is used only to determine "cuts" and "stuns".
  */
-static int monster_critical(int dice, int sides, HIT_POINT dam)
+static int monster_critical(DICE_NUMBER dice, DICE_SID sides, HIT_POINT dam)
 {
        int max = 0;
        int total = dice * sides;
@@ -156,7 +156,7 @@ static int monster_critical(int dice, int sides, HIT_POINT dam)
  * Always miss 5% of the time, Always hit 5% of the time.
  * Otherwise, match monster power against player armor.
  */
-static int check_hit(int power, int level, int stun)
+static int check_hit(int power, DEPTH level, int stun)
 {
        int i, k, ac;
 
@@ -363,7 +363,6 @@ static void natural_attack(s16b m_idx, int attack, bool *fear, bool *mdeath)
        /* Test for hit */
        if ((!(r_ptr->flags2 & RF2_QUANTUM) || !randint0(2)) && test_hit_norm(chance, r_ptr->ac, m_ptr->ml))
        {
-               /* Sound */
                sound(SOUND_HIT);
                msg_format(_("%sを%sで攻撃した。", "You hit %s with your %s."), m_name, atk_desc);
 
@@ -415,7 +414,6 @@ static void natural_attack(s16b m_idx, int attack, bool *fear, bool *mdeath)
        /* Player misses */
        else
        {
-               /* Sound */
                sound(SOUND_MISS);
 
                /* Message */
@@ -436,9 +434,9 @@ static void natural_attack(s16b m_idx, int attack, bool *fear, bool *mdeath)
 * @details
 * If no "weapon" is available, then "punch" the monster one time.
 */
-static void py_attack_aux(int y, int x, bool *fear, bool *mdeath, s16b hand, BIT_FLAGS mode)
+static void py_attack_aux(POSITION y, POSITION x, bool *fear, bool *mdeath, s16b hand, BIT_FLAGS mode)
 {
-       int             num = 0, bonus, chance, vir;
+       int num = 0, bonus, chance, vir;
        HIT_POINT k;
 
        cave_type       *c_ptr = &cave[y][x];
@@ -465,7 +463,7 @@ static void py_attack_aux(int y, int x, bool *fear, bool *mdeath, s16b hand, BIT
        bool            can_drain = FALSE;
        int             num_blow;
        int             drain_left = MAX_VAMPIRIC_DRAIN;
-       u32b flgs[TR_FLAG_SIZE]; /* A massive hack -- life-draining weapons */
+       BIT_FLAGS flgs[TR_FLAG_SIZE]; /* A massive hack -- life-draining weapons */
        bool            is_human = (r_ptr->d_char == 'p');
        bool            is_lowlevel = (r_ptr->level < (p_ptr->lev - 15));
        bool            zantetsu_mukou, e_j_mukou;
@@ -603,7 +601,6 @@ static void py_attack_aux(int y, int x, bool *fear, bool *mdeath, s16b hand, BIT
                {
                        int vorpal_chance = ((o_ptr->name1 == ART_VORPAL_BLADE) || (o_ptr->name1 == ART_CHAINSWORD)) ? 2 : 4;
 
-                       /* Sound */
                        sound(SOUND_HIT);
 
                        /* Message */
@@ -670,7 +667,7 @@ static void py_attack_aux(int y, int x, bool *fear, bool *mdeath, s16b hand, BIT
                                int min_level = 1;
                                const martial_arts *ma_ptr = &ma_blows[0], *old_ptr = &ma_blows[0];
                                int resist_stun = 0;
-                               int weight = 8;
+                               WEIGHT weight = 8;
 
                                if (r_ptr->flags1 & RF1_UNIQUE) resist_stun += 88;
                                if (r_ptr->flags3 & RF3_NO_STUN) resist_stun += 66;
@@ -1199,7 +1196,6 @@ static void py_attack_aux(int y, int x, bool *fear, bool *mdeath, s16b hand, BIT
                        {
                                u32b flgs_aux[TR_FLAG_SIZE];
 
-                               /* Sound */
                                sound(SOUND_HIT);
 
                                /* Message */
@@ -1296,7 +1292,6 @@ static void py_attack_aux(int y, int x, bool *fear, bool *mdeath, s16b hand, BIT
                        }
                        else
                        {
-                               /* Sound */
                                sound(SOUND_MISS);
 
                                /* Message */
@@ -1512,7 +1507,6 @@ bool py_attack(POSITION y, POSITION x, BIT_FLAGS mode)
        /* Hack -- delay fear messages */
        if (fear && m_ptr->ml && !mdeath)
        {
-               /* Sound */
                sound(SOUND_FLEE);
 
                /* Message */
@@ -1540,7 +1534,8 @@ bool make_attack_normal(MONSTER_IDX m_idx)
 
        int ap_cnt;
 
-       int i, k, tmp, ac, rlev;
+       INVENTORY_IDX i;
+       int k, tmp, ac, rlev;
        int do_cut, do_stun;
 
        s32b gold;
@@ -2073,7 +2068,7 @@ bool make_attack_normal(MONSTER_IDX m_idx)
                                        for (k = 0; k < 10; k++)
                                        {
                                                /* Pick an item */
-                                               i = randint0(INVEN_PACK);
+                                               i = (INVENTORY_IDX)randint0(INVEN_PACK);
 
                                                /* Obtain the item */
                                                o_ptr = &inventory[i];
@@ -2221,7 +2216,7 @@ bool make_attack_normal(MONSTER_IDX m_idx)
                                                s16b o_idx;
 
                                                /* Pick an item */
-                                               i = randint0(INVEN_PACK);
+                                               i = (INVENTORY_IDX)randint0(INVEN_PACK);
 
                                                /* Obtain the item */
                                                o_ptr = &inventory[i];
@@ -2317,7 +2312,7 @@ bool make_attack_normal(MONSTER_IDX m_idx)
                                        for (k = 0; k < 10; k++)
                                        {
                                                /* Pick an item from the pack */
-                                               i = randint0(INVEN_PACK);
+                                               i = (INVENTORY_IDX)randint0(INVEN_PACK);
 
                                                /* Get the item */
                                                o_ptr = &inventory[i];
@@ -3313,7 +3308,7 @@ bool make_attack_normal(MONSTER_IDX m_idx)
                                                {
                                                        int j;
                                                        BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
-                                                       int typ[4][2] = {
+                                                       EFFECT_ID typ[4][2] = {
                                                                { INVEN_HEAD, GF_OLD_CONF },
                                                                { INVEN_LARM,  GF_OLD_SLEEP },
                                                                { INVEN_HANDS, GF_TURN_ALL },