OSDN Git Service

[Refactor] #37353 コメント整理 / Refactor comments.
[hengband/hengband.git] / src / cmd2.c
index 465386f..bafddf7 100644 (file)
@@ -384,8 +384,6 @@ void do_cmd_search(void)
                /* Cancel the arg */
                command_arg = 0;
        }
-
-       /* Take a turn */
        p_ptr->energy_use = 100;
 
        /* Search */
@@ -400,22 +398,17 @@ void do_cmd_search(void)
  * @param trapped TRUEならばトラップが存在する箱のみ、FALSEならば空でない箱全てを対象にする
  * @return 箱が存在する場合そのオブジェクトID、存在しない場合0を返す。
  */
-static s16b chest_check(int y, int x, bool trapped)
+static OBJECT_IDX chest_check(POSITION y, POSITION x, bool trapped)
 {
        cave_type *c_ptr = &cave[y][x];
-
-       s16b this_o_idx, next_o_idx = 0;
-
+       OBJECT_IDX this_o_idx, next_o_idx = 0;
 
        /* Scan all objects in the grid */
        for (this_o_idx = c_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
        {
                object_type *o_ptr;
 
-               /* Acquire object */
                o_ptr = &o_list[this_o_idx];
-
-               /* Acquire next object */
                next_o_idx = o_ptr->next_o_idx;
 
                /* Skip unknown chests XXX XXX */
@@ -429,8 +422,6 @@ static s16b chest_check(int y, int x, bool trapped)
                        return (this_o_idx);
                }
        }
-
-       /* No chest */
        return (0);
 }
 
@@ -444,18 +435,13 @@ static s16b chest_check(int y, int x, bool trapped)
  * @details
  * Assume there is no monster blocking the destination
  */
-static bool do_cmd_open_chest(int y, int x, s16b o_idx)
+static bool do_cmd_open_chest(POSITION y, POSITION x, OBJECT_IDX o_idx)
 {
        int i, j;
-
        bool flag = TRUE;
-
        bool more = FALSE;
-
        object_type *o_ptr = &o_list[o_idx];
 
-
-       /* Take a turn */
        p_ptr->energy_use = 100;
 
        /* Attempt to unlock it */
@@ -505,14 +491,9 @@ static bool do_cmd_open_chest(int y, int x, s16b o_idx)
                /* Let the Chest drop items */
                chest_death(FALSE, y, x, o_idx);
        }
-
-       /* Result */
        return (more);
 }
 
-
-#if defined(ALLOW_EASY_OPEN) || defined(ALLOW_EASY_DISARM) /* TNB */
-
 /*!
  * @brief 地形は開くものであって、かつ開かれているかを返す /
  * Attempt to open the given chest at the given location
@@ -547,7 +528,7 @@ static int count_dt(POSITION *y, POSITION *x, bool (*test)(IDX feat), bool under
        for (d = 0; d < 9; d++)
        {
                cave_type *c_ptr;
-               s16b feat;
+               FEAT_IDX feat;
 
                /* if not searching under player continue */
                if ((d == 8) && !under) continue;
@@ -594,7 +575,7 @@ static int count_dt(POSITION *y, POSITION *x, bool (*test)(IDX feat), bool under
 static int count_chests(POSITION *y, POSITION *x, bool trapped)
 {
        int d, count;
-       IDX o_idx;
+       OBJECT_IDX o_idx;
 
        object_type *o_ptr;
 
@@ -605,8 +586,8 @@ static int count_chests(POSITION *y, POSITION *x, bool trapped)
        for (d = 0; d < 9; d++)
        {
                /* Extract adjacent (legal) location */
-               int yy = p_ptr->y + ddy_ddd[d];
-               int xx = p_ptr->x + ddx_ddd[d];
+               POSITION yy = p_ptr->y + ddy_ddd[d];
+               POSITION xx = p_ptr->x + ddx_ddd[d];
 
                /* No (visible) chest is there */
                if ((o_idx = chest_check(yy, xx, FALSE)) == 0) continue;
@@ -655,9 +636,6 @@ static DIRECTION coords_to_dir(POSITION y, POSITION x)
        return d[dx + 1][dy + 1];
 }
 
-#endif /* defined(ALLOW_EASY_OPEN) || defined(ALLOW_EASY_DISARM) -- TNB */
-
-
 /*!
  * @brief 「開ける」動作コマンドのサブルーチン /
  * Perform the basic "open" command on doors
@@ -669,19 +647,15 @@ static DIRECTION coords_to_dir(POSITION y, POSITION x)
  * Assume there is no monster blocking the destination
  * Returns TRUE if repeated commands may continue
  */
-static bool do_cmd_open_aux(int y, int x)
+static bool do_cmd_open_aux(POSITION y, POSITION x)
 {
        int i, j;
 
        /* Get requested grid */
        cave_type *c_ptr = &cave[y][x];
-
        feature_type *f_ptr = &f_info[c_ptr->feat];
-
        bool more = FALSE;
 
-
-       /* Take a turn */
        p_ptr->energy_use = 100;
 
        /* Seeing true feature code (ignore mimic) */
@@ -706,7 +680,7 @@ static bool do_cmd_open_aux(int y, int x)
                /* Extract the lock power */
                j = f_ptr->power;
 
-               /* Extract the difficulty XXX XXX XXX */
+               /* Extract the difficulty */
                j = i - (j * 4);
 
                /* Always have a small chance of success */
@@ -715,13 +689,11 @@ static bool do_cmd_open_aux(int y, int x)
                /* Success */
                if (randint0(100) < j)
                {
-                       /* Message */
                        msg_print(_("鍵をはずした。", "You have picked the lock."));
 
                        /* Open the door */
                        cave_alter_feat(y, x, FF_OPEN);
 
-                       /* Sound */
                        sound(SOUND_OPENDOOR);
 
                        /* Experience */
@@ -734,7 +706,6 @@ static bool do_cmd_open_aux(int y, int x)
                        /* Failure */
                        if (flush_failure) flush();
 
-                       /* Message */
                        msg_print(_("鍵をはずせなかった。", "You failed to pick the lock."));
 
                        /* We may keep trying */
@@ -748,11 +719,8 @@ static bool do_cmd_open_aux(int y, int x)
                /* Open the door */
                cave_alter_feat(y, x, FF_OPEN);
 
-               /* Sound */
                sound(SOUND_OPENDOOR);
        }
-
-       /* Result */
        return (more);
 }
 
@@ -767,7 +735,7 @@ void do_cmd_open(void)
 {
        POSITION y, x;
        DIRECTION dir;
-       IDX o_idx;
+       OBJECT_IDX o_idx;
 
        bool more = FALSE;
 
@@ -776,8 +744,6 @@ void do_cmd_open(void)
                set_action(ACTION_NONE);
        }
 
-#ifdef ALLOW_EASY_OPEN /* TNB */
-
        /* Option: Pick a direction */
        if (easy_open)
        {
@@ -798,8 +764,6 @@ void do_cmd_open(void)
                }
        }
 
-#endif /* ALLOW_EASY_OPEN -- TNB */
-
        /* Allow repeated command */
        if (command_arg)
        {
@@ -816,7 +780,7 @@ void do_cmd_open(void)
        /* Get a "repeated" direction */
        if (get_rep_dir(&dir, TRUE))
        {
-               s16b feat;
+               FEAT_IDX feat;
                cave_type *c_ptr;
 
                /* Get requested location */
@@ -835,17 +799,14 @@ void do_cmd_open(void)
                /* Nothing useful */
                if (!have_flag(f_info[feat].flags, FF_OPEN) && !o_idx)
                {
-                       /* Message */
                        msg_print(_("そこには開けるものが見当たらない。", "You see nothing there to open."));
                }
 
                /* Monster in the way */
                else if (c_ptr->m_idx && p_ptr->riding != c_ptr->m_idx)
                {
-                       /* Take a turn */
                        p_ptr->energy_use = 100;
 
-                       /* Message */
                        msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
                        
                        /* Attack */
@@ -868,7 +829,7 @@ void do_cmd_open(void)
        }
 
        /* Cancel repeat unless we may continue */
-       if (!more) disturb(0, 0);
+       if (!more) disturb(FALSE, FALSE);
 }
 
 
@@ -884,14 +845,13 @@ void do_cmd_open(void)
  * Assume there is no monster blocking the destination
  * Returns TRUE if repeated commands may continue
  */
-static bool do_cmd_close_aux(int y, int x)
+static bool do_cmd_close_aux(POSITION y, POSITION x)
 {
        /* Get grid and contents */
        cave_type *c_ptr = &cave[y][x];
-       s16b      old_feat = c_ptr->feat;
-       bool      more = FALSE;
+       FEAT_IDX old_feat = c_ptr->feat;
+       bool more = FALSE;
 
-       /* Take a turn */
        p_ptr->energy_use = 100;
 
        /* Seeing true feature code (ignore mimic) */
@@ -905,7 +865,6 @@ static bool do_cmd_close_aux(int y, int x)
                if ((c_ptr->o_idx || (c_ptr->info & CAVE_OBJECT)) &&
                    (closed_feat != old_feat) && !have_flag(f_info[closed_feat].flags, FF_DROP))
                {
-                       /* Message */
                        msg_print(_("何かがつっかえて閉まらない。", "There seems stuck."));
                }
                else
@@ -916,18 +875,14 @@ static bool do_cmd_close_aux(int y, int x)
                        /* Broken door */
                        if (old_feat == c_ptr->feat)
                        {
-                               /* Message */
                                msg_print(_("ドアは壊れてしまっている。", "The door appears to be broken."));
                        }
                        else
                        {
-                               /* Sound */
                                sound(SOUND_SHUTDOOR);
                        }
                }
        }
-
-       /* Result */
        return (more);
 }
 
@@ -951,8 +906,6 @@ void do_cmd_close(void)
                set_action(ACTION_NONE);
        }
 
-#ifdef ALLOW_EASY_OPEN /* TNB */
-
        /* Option: Pick a direction */
        if (easy_open)
        {
@@ -963,8 +916,6 @@ void do_cmd_close(void)
                }
        }
 
-#endif /* ALLOW_EASY_OPEN -- TNB */
-
        /* Allow repeated command */
        if (command_arg)
        {
@@ -979,10 +930,10 @@ void do_cmd_close(void)
        }
 
        /* Get a "repeated" direction */
-       if (get_rep_dir(&dir,FALSE))
+       if (get_rep_dir(&dir, FALSE))
        {
                cave_type *c_ptr;
-               s16b feat;
+               FEAT_IDX feat;
 
                /* Get requested location */
                y = p_ptr->y + ddy[dir];
@@ -997,17 +948,14 @@ void do_cmd_close(void)
                /* Require open/broken door */
                if (!have_flag(f_info[feat].flags, FF_CLOSE))
                {
-                       /* Message */
                        msg_print(_("そこには閉じるものが見当たらない。", "You see nothing there to close."));
                }
 
                /* Monster in the way */
                else if (c_ptr->m_idx)
                {
-                       /* Take a turn */
                        p_ptr->energy_use = 100;
 
-                       /* Message */
                        msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
 
                        /* Attack */
@@ -1023,7 +971,7 @@ void do_cmd_close(void)
        }
 
        /* Cancel repeat unless we may continue */
-       if (!more) disturb(0, 0);
+       if (!more) disturb(FALSE, FALSE);
 }
 
 
@@ -1034,31 +982,26 @@ void do_cmd_close(void)
  * @param x 対象を行うマスのX座標
  * @return 
  */
-static bool do_cmd_tunnel_test(int y, int x)
+static bool do_cmd_tunnel_test(POSITION y, POSITION x)
 {
        cave_type *c_ptr = &cave[y][x];
 
        /* Must have knowledge */
        if (!(c_ptr->info & CAVE_MARK))
        {
-               /* Message */
                msg_print(_("そこには何も見当たらない。", "You see nothing there."));
 
-               /* Nope */
                return (FALSE);
        }
 
        /* Must be a wall/door/etc */
        if (!cave_have_flag_grid(c_ptr, FF_TUNNEL))
        {
-               /* Message */
                msg_print(_("そこには掘るものが見当たらない。", "You see nothing there to tunnel."));
 
-               /* Nope */
                return (FALSE);
        }
 
-       /* Okay */
        return (TRUE);
 }
 
@@ -1074,7 +1017,7 @@ static bool do_cmd_tunnel_test(int y, int x)
  * Do not use twall anymore
  * Returns TRUE if repeated commands may continue
  */
-static bool do_cmd_tunnel_aux(int y, int x)
+static bool do_cmd_tunnel_aux(POSITION y, POSITION x)
 {
        cave_type *c_ptr;
        feature_type *f_ptr, *mimic_f_ptr;
@@ -1085,7 +1028,6 @@ static bool do_cmd_tunnel_aux(int y, int x)
        /* Verify legality */
        if (!do_cmd_tunnel_test(y, x)) return (FALSE);
 
-       /* Take a turn */
        p_ptr->energy_use = 100;
 
        /* Get grid */
@@ -1098,7 +1040,6 @@ static bool do_cmd_tunnel_aux(int y, int x)
 
        name = f_name + mimic_f_ptr->name;
 
-       /* Sound */
        sound(SOUND_DIG);
 
        if (have_flag(f_ptr->flags, FF_PERMANENT))
@@ -1122,7 +1063,6 @@ static bool do_cmd_tunnel_aux(int y, int x)
                /* Dig */
                if (p_ptr->skill_dig > randint0(20 * power))
                {
-                       /* Message */
                        msg_format(_("%sをくずした。", "You have removed the %s."), name);
 
                        /* Remove the feature */
@@ -1154,7 +1094,6 @@ static bool do_cmd_tunnel_aux(int y, int x)
                                p_ptr->update |= (PU_FLOW);
                        }
                        
-                       /* Sound */
                        if (have_flag(f_ptr->flags, FF_GLASS)) sound(SOUND_GLASS);
 
                        /* Remove the feature */
@@ -1189,8 +1128,6 @@ static bool do_cmd_tunnel_aux(int y, int x)
                /* Occasional Search XXX XXX */
                if (randint0(100) < 25) search();
        }
-
-       /* Result */
        return more;
 }
 
@@ -1213,7 +1150,7 @@ void do_cmd_tunnel(void)
        int                     y, x, dir;
 
        cave_type       *c_ptr;
-       s16b feat;
+       FEAT_IDX feat;
 
        bool            more = FALSE;
 
@@ -1252,7 +1189,6 @@ void do_cmd_tunnel(void)
                /* No tunnelling through doors */
                if (have_flag(f_info[feat].flags, FF_DOOR))
                {
-                       /* Message */
                        msg_print(_("ドアは掘れない。", "You cannot tunnel through doors."));
                }
 
@@ -1265,10 +1201,8 @@ void do_cmd_tunnel(void)
                /* A monster is in the way */
                else if (c_ptr->m_idx)
                {
-                       /* Take a turn */
                        p_ptr->energy_use = 100;
 
-                       /* Message */
                        msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
 
                        /* Attack */
@@ -1284,12 +1218,9 @@ void do_cmd_tunnel(void)
        }
 
        /* Cancel repetition unless we can continue */
-       if (!more) disturb(0, 0);
+       if (!more) disturb(FALSE, FALSE);
 }
 
-
-#ifdef ALLOW_EASY_OPEN /* TNB */
-
 /*!
  * @brief 移動処理による簡易な「開く」処理 /
  * easy_open_door --
@@ -1304,7 +1235,7 @@ void do_cmd_tunnel(void)
  *     do_cmd_open_test() and do_cmd_open_aux().
  * </pre>
  */
-bool easy_open_door(int y, int x)
+bool easy_open_door(POSITION y, POSITION x)
 {
        int i, j;
 
@@ -1314,7 +1245,6 @@ bool easy_open_door(int y, int x)
        /* Must be a closed door */
        if (!is_closed_door(c_ptr->feat))
        {
-               /* Nope */
                return (FALSE);
        }
 
@@ -1339,7 +1269,7 @@ bool easy_open_door(int y, int x)
                /* Extract the lock power */
                j = f_ptr->power;
 
-               /* Extract the difficulty XXX XXX XXX */
+               /* Extract the difficulty */
                j = i - (j * 4);
 
                /* Always have a small chance of success */
@@ -1348,13 +1278,11 @@ bool easy_open_door(int y, int x)
                /* Success */
                if (randint0(100) < j)
                {
-                       /* Message */
                        msg_print(_("鍵をはずした。", "You have picked the lock."));
 
                        /* Open the door */
                        cave_alter_feat(y, x, FF_OPEN);
 
-                       /* Sound */
                        sound(SOUND_OPENDOOR);
 
                        /* Experience */
@@ -1367,7 +1295,6 @@ bool easy_open_door(int y, int x)
                        /* Failure */
                        if (flush_failure) flush();
 
-                       /* Message */
                        msg_print(_("鍵をはずせなかった。", "You failed to pick the lock."));
 
                }
@@ -1379,17 +1306,11 @@ bool easy_open_door(int y, int x)
                /* Open the door */
                cave_alter_feat(y, x, FF_OPEN);
 
-               /* Sound */
                sound(SOUND_OPENDOOR);
        }
-
-       /* Result */
        return (TRUE);
 }
 
-#endif /* ALLOW_EASY_OPEN -- TNB */
-
-
 /*!
  * @brief 箱のトラップを解除するコマンドのメインルーチン /
  * Perform the basic "disarm" command
@@ -1404,16 +1325,12 @@ bool easy_open_door(int y, int x)
  * Returns TRUE if repeated commands may continue
  * </pre>
  */
-static bool do_cmd_disarm_chest(int y, int x, s16b o_idx)
+static bool do_cmd_disarm_chest(POSITION y, POSITION x, OBJECT_IDX o_idx)
 {
        int i, j;
-
        bool more = FALSE;
-
        object_type *o_ptr = &o_list[o_idx];
 
-
-       /* Take a turn */
        p_ptr->energy_use = 100;
 
        /* Get the "disarm" factor */
@@ -1472,8 +1389,6 @@ static bool do_cmd_disarm_chest(int y, int x, s16b o_idx)
                sound(SOUND_FAIL);
                chest_trap(y, x, o_idx);
        }
-
-       /* Result */
        return (more);
 }
 
@@ -1492,15 +1407,8 @@ static bool do_cmd_disarm_chest(int y, int x, s16b o_idx)
  * Returns TRUE if repeated commands may continue
  * </pre>
  */
-#ifdef ALLOW_EASY_DISARM /* TNB */
-
-bool do_cmd_disarm_aux(int y, int x, int dir)
-
-#else /* ALLOW_EASY_DISARM -- TNB */
-
-static bool do_cmd_disarm_aux(int y, int x, int dir)
 
-#endif /* ALLOW_EASY_DISARM -- TNB */
+bool do_cmd_disarm_aux(POSITION y, POSITION x, DIRECTION dir)
 {
        /* Get grid and contents */
        cave_type *c_ptr = &cave[y][x];
@@ -1513,15 +1421,12 @@ static bool do_cmd_disarm_aux(int y, int x, int dir)
 
        /* Extract trap "power" */
        int power = f_ptr->power;
-
        bool more = FALSE;
 
        /* Get the "disarm" factor */
        int i = p_ptr->skill_dis;
-
        int j;
 
-       /* Take a turn */
        p_ptr->energy_use = 100;
 
        /* Penalize some conditions */
@@ -1537,7 +1442,6 @@ static bool do_cmd_disarm_aux(int y, int x, int dir)
        /* Success */
        if (randint0(100) < j)
        {
-               /* Message */
                msg_format(_("%sを解除した。", "You have disarmed the %s."), name);
                
                /* Reward */
@@ -1546,17 +1450,8 @@ static bool do_cmd_disarm_aux(int y, int x, int dir)
                /* Remove the trap */
                cave_alter_feat(y, x, FF_DISARM);
 
-#ifdef ALLOW_EASY_DISARM /* TNB */
-
                /* Move the player onto the trap */
                move_player(dir, easy_disarm, FALSE);
-
-#else /* ALLOW_EASY_DISARM -- TNB */
-
-               /* move the player onto the trap grid */
-               move_player(dir, FALSE, FALSE);
-
-#endif /* ALLOW_EASY_DISARM -- TNB */
        }
 
        /* Failure -- Keep trying */
@@ -1565,7 +1460,6 @@ static bool do_cmd_disarm_aux(int y, int x, int dir)
                /* Failure */
                if (flush_failure) flush();
 
-               /* Message */
                msg_format(_("%sの解除に失敗した。", "You failed to disarm the %s."), name);
 
                /* We may keep trying */
@@ -1575,23 +1469,10 @@ static bool do_cmd_disarm_aux(int y, int x, int dir)
        /* Failure -- Set off the trap */
        else
        {
-               /* Message */
                msg_format(_("%sを作動させてしまった!", "You set off the %s!"), name);
-
-#ifdef ALLOW_EASY_DISARM /* TNB */
-
                /* Move the player onto the trap */
                move_player(dir, easy_disarm, FALSE);
-
-#else /* ALLOW_EASY_DISARM -- TNB */
-
-               /* Move the player onto the trap */
-               move_player(dir, FALSE, FALSE);
-
-#endif /* ALLOW_EASY_DISARM -- TNB */
        }
-
-       /* Result */
        return (more);
 }
 
@@ -1614,7 +1495,6 @@ void do_cmd_disarm(void)
                set_action(ACTION_NONE);
        }
 
-#ifdef ALLOW_EASY_DISARM /* TNB */
 
        /* Option: Pick a direction */
        if (easy_disarm)
@@ -1635,7 +1515,6 @@ void do_cmd_disarm(void)
                }
        }
 
-#endif /* ALLOW_EASY_DISARM -- TNB */
 
        /* Allow repeated command */
        if (command_arg)
@@ -1654,7 +1533,7 @@ void do_cmd_disarm(void)
        if (get_rep_dir(&dir,TRUE))
        {
                cave_type *c_ptr;
-               s16b feat;
+               FEAT_IDX feat;
 
                /* Get location */
                y = p_ptr->y + ddy[dir];
@@ -1672,14 +1551,12 @@ void do_cmd_disarm(void)
                /* Disarm a trap */
                if (!is_trap(feat) && !o_idx)
                {
-                       /* Message */
                        msg_print(_("そこには解除するものが見当たらない。", "You see nothing there to disarm."));
                }
 
                /* Monster in the way */
                else if (c_ptr->m_idx && p_ptr->riding != c_ptr->m_idx)
                {
-                       /* Message */
                        msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
 
                        /* Attack */
@@ -1702,7 +1579,7 @@ void do_cmd_disarm(void)
        }
 
        /* Cancel repeat unless told not to */
-       if (!more) disturb(0, 0);
+       if (!more) disturb(FALSE, FALSE);
 }
 
 
@@ -1720,7 +1597,7 @@ void do_cmd_disarm(void)
  * Returns TRUE if repeated commands may continue
  * </pre>
  */
-static bool do_cmd_bash_aux(int y, int x, int dir)
+static bool do_cmd_bash_aux(POSITION y, POSITION x, DIRECTION dir)
 {
        /* Get grid */
        cave_type       *c_ptr = &cave[y][x];
@@ -1739,13 +1616,11 @@ static bool do_cmd_bash_aux(int y, int x, int dir)
 
        cptr name = f_name + f_info[get_feat_mimic(c_ptr)].name;
 
-       /* Take a turn */
        p_ptr->energy_use = 100;
 
-       /* Message */
        msg_format(_("%sに体当たりをした!", "You smash into the %s!"), name);
 
-       /* Compare bash power to door power XXX XXX XXX */
+       /* Compare bash power to door power */
        temp = (bash - (temp * 10));
 
        if (p_ptr->pclass == CLASS_BERSERKER) temp *= 2;
@@ -1756,10 +1631,8 @@ static bool do_cmd_bash_aux(int y, int x, int dir)
        /* Hack -- attempt to bash down the door */
        if (randint0(100) < temp)
        {
-               /* Message */
                msg_format(_("%sを壊した!", "The %s crashes open!"), name);
 
-               /* Sound */
                sound(have_flag(f_ptr->flags, FF_GLASS) ? SOUND_GLASS : SOUND_OPENDOOR);
 
                /* Break down the door */
@@ -1782,7 +1655,6 @@ static bool do_cmd_bash_aux(int y, int x, int dir)
        else if (randint0(100) < adj_dex_safe[p_ptr->stat_ind[A_DEX]] +
                 p_ptr->lev)
        {
-               /* Message */
                msg_format(_("この%sは頑丈だ。", "The %s holds firm."), name);
 
                /* Allow repeated bashing */
@@ -1792,14 +1664,11 @@ static bool do_cmd_bash_aux(int y, int x, int dir)
        /* High dexterity yields coolness */
        else
        {
-               /* Message */
                msg_print(_("体のバランスをくずしてしまった。", "You are off-balance."));
 
                /* Hack -- Lose balance ala paralysis */
                (void)set_paralyzed(p_ptr->paralyzed + 2 + randint0(2));
        }
-
-       /* Result */
        return (more);
 }
 
@@ -1852,7 +1721,7 @@ void do_cmd_bash(void)
        /* Get a "repeated" direction */
        if (get_rep_dir(&dir,FALSE))
        {
-               s16b feat;
+               FEAT_IDX feat;
 
                /* Bash location */
                y = p_ptr->y + ddy[dir];
@@ -1867,17 +1736,14 @@ void do_cmd_bash(void)
                /* Nothing useful */
                if (!have_flag(f_info[feat].flags, FF_BASH))
                {
-                       /* Message */
                        msg_print(_("そこには体当たりするものが見当たらない。", "You see nothing there to bash."));
                }
 
                /* Monster in the way */
                else if (c_ptr->m_idx)
                {
-                       /* Take a turn */
                        p_ptr->energy_use = 100;
 
-                       /* Message */
                        msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
 
                        /* Attack */
@@ -1893,7 +1759,7 @@ void do_cmd_bash(void)
        }
 
        /* Unless valid action taken, cancel bash */
-       if (!more) disturb(0, 0);
+       if (!more) disturb(FALSE, FALSE);
 }
 
 
@@ -1906,7 +1772,7 @@ void do_cmd_bash(void)
  *
  * Attack monsters, tunnel through walls, disarm traps, open doors.
  *
- * Consider confusion XXX XXX XXX
+ * Consider confusion 
  *
  * This command must always take a turn, to prevent free detection
  * of invisible monsters.
@@ -1942,7 +1808,7 @@ void do_cmd_alter(void)
        /* Get a direction */
        if (get_rep_dir(&dir,TRUE))
        {
-               s16b feat;
+               FEAT_IDX feat;
                feature_type *f_ptr;
 
                /* Get location */
@@ -1956,7 +1822,6 @@ void do_cmd_alter(void)
                feat = get_feat_mimic(c_ptr);
                f_ptr = &f_info[feat];
 
-               /* Take a turn */
                p_ptr->energy_use = 100;
 
                /* Attack monsters */
@@ -1996,16 +1861,14 @@ void do_cmd_alter(void)
                        more = do_cmd_disarm_aux(y, x, dir);
                }
 
-               /* Oops */
                else
                {
-                       /* Oops */
                        msg_print(_("何もない空中を攻撃した。", "You attack the empty air."));
                }
        }
 
        /* Cancel repetition unless we can continue */
-       if (!more) disturb(0, 0);
+       if (!more) disturb(FALSE, FALSE);
 }
 
 
@@ -2017,12 +1880,12 @@ void do_cmd_alter(void)
  * @return オブジェクトがある場合TRUEを返す
  * @details
  * <pre>
- * XXX XXX XXX Let user choose a pile of spikes, perhaps?
+ * Let user choose a pile of spikes, perhaps?
  * </pre>
  */
-static bool get_spike(int *ip)
+static bool get_spike(INVENTORY_IDX *ip)
 {
-       int i;
+       INVENTORY_IDX i;
 
        /* Check every item in the pack */
        for (i = 0; i < INVEN_PACK; i++)
@@ -2043,7 +1906,6 @@ static bool get_spike(int *ip)
                }
        }
 
-       /* Oops */
        return (FALSE);
 }
 
@@ -2059,7 +1921,7 @@ static bool get_spike(int *ip)
  */
 void do_cmd_spike(void)
 {
-       int dir;
+       DIRECTION dir;
 
        if (p_ptr->special_defense & KATA_MUSOU)
        {
@@ -2069,9 +1931,10 @@ void do_cmd_spike(void)
        /* Get a "repeated" direction */
        if (get_rep_dir(&dir,FALSE))
        {
-               int y, x, item;
+               POSITION y, x;
+               INVENTORY_IDX item;
                cave_type *c_ptr;
-               s16b feat;
+               FEAT_IDX feat;
 
                /* Get location */
                y = p_ptr->y + ddy[dir];
@@ -2086,24 +1949,20 @@ void do_cmd_spike(void)
                /* Require closed door */
                if (!have_flag(f_info[feat].flags, FF_SPIKE))
                {
-                       /* Message */
                        msg_print(_("そこにはくさびを打てるものが見当たらない。", "You see nothing there to spike."));
                }
 
                /* Get a spike */
                else if (!get_spike(&item))
                {
-                       /* Message */
                        msg_print(_("くさびを持っていない!", "You have no spikes!"));
                }
 
                /* Is a monster in the way? */
                else if (c_ptr->m_idx)
                {
-                       /* Take a turn */
                        p_ptr->energy_use = 100;
 
-                       /* Message */
                        msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
 
                        /* Attack */
@@ -2113,7 +1972,6 @@ void do_cmd_spike(void)
                /* Go for it */
                else
                {
-                       /* Take a turn */
                        p_ptr->energy_use = 100;
 
                        /* Successful jamming */
@@ -2138,7 +1996,7 @@ void do_cmd_spike(void)
  */
 void do_cmd_walk(bool pickup)
 {
-       int dir;
+       DIRECTION dir;
 
        bool more = FALSE;
 
@@ -2159,7 +2017,6 @@ void do_cmd_walk(bool pickup)
        /* Get a "repeated" direction */
        if (get_rep_dir(&dir, FALSE))
        {
-               /* Take a turn */
                p_ptr->energy_use = 100;
 
                if ((dir != 5) && (p_ptr->special_defense & KATA_MUSOU))
@@ -2203,7 +2060,7 @@ void do_cmd_walk(bool pickup)
        }
 
        /* Cancel repeat unless we may continue */
-       if (!more) disturb(0, 0);
+       if (!more) disturb(FALSE, FALSE);
 }
 
 
@@ -2214,7 +2071,7 @@ void do_cmd_walk(bool pickup)
  */
 void do_cmd_run(void)
 {
-       int dir;
+       DIRECTION dir;
 
        /* Hack -- no running when confused */
        if (p_ptr->confused)
@@ -2264,7 +2121,6 @@ void do_cmd_stay(bool pickup)
                command_arg = 0;
        }
 
-       /* Take a turn */
        p_ptr->energy_use = 100;
 
        if (pickup) mpe_mode |= MPE_DO_PICKUP;
@@ -2331,7 +2187,7 @@ void do_cmd_rest(void)
 
        if (p_ptr->special_defense & NINJA_S_STEALTH) set_superstealth(FALSE);
 
-       /* Take a turn XXX XXX XXX (?) */
+       /* Take a turn (?) */
        p_ptr->energy_use = 100;
 
        /* The sin of sloth */
@@ -2358,8 +2214,6 @@ void do_cmd_rest(void)
 
        /* Redraw the state */
        p_ptr->redraw |= (PR_STATE);
-
-       /* Handle stuff */
        handle_stuff();
 
        /* Refresh */
@@ -2439,7 +2293,7 @@ static s16b tot_dam_aux_shot(object_type *o_ptr, int tdam, monster_type *m_ptr)
 
        monster_race *r_ptr = &r_info[m_ptr->r_idx];
 
-       u32b flgs[TR_FLAG_SIZE];
+       BIT_FLAGS flgs[TR_FLAG_SIZE];
 
        /* Extract the flags */
        object_flags(o_ptr, flgs);
@@ -2834,10 +2688,11 @@ static s16b tot_dam_aux_shot(object_type *o_ptr, int tdam, monster_type *m_ptr)
  * Note that Bows of "Extra Shots" give an extra shot.
  * </pre>
  */
-void do_cmd_fire_aux(int item, object_type *j_ptr)
+void do_cmd_fire_aux(INVENTORY_IDX item, object_type *j_ptr)
 {
-       int dir;
-       int i, y, x, ny, nx, ty, tx, prev_y, prev_x;
+       DIRECTION dir;
+       int i;
+       POSITION y, x, ny, nx, ty, tx, prev_y, prev_x;
        int tdam_base, tdis, thits, tmul;
        int bonus, chance;
        int cur_dis, visible;
@@ -2872,7 +2727,6 @@ void do_cmd_fire_aux(int item, object_type *j_ptr)
        /* Sniper - Cannot shot a single arrow twice */
        if ((snipe_type == SP_DOUBLE) && (o_ptr->number < 2)) snipe_type = SP_NONE;
 
-       /* Describe the object */
        object_desc(o_name, o_ptr, OD_OMIT_PREFIX);
 
        /* Use the proper number of shots */
@@ -2968,8 +2822,6 @@ void do_cmd_fire_aux(int item, object_type *j_ptr)
        /* Start at the player */
        y = p_ptr->y;
        x = p_ptr->x;
-
-       /* Get local object */
        q_ptr = &forge;
 
        /* Obtain a local object */
@@ -2993,10 +2845,7 @@ void do_cmd_fire_aux(int item, object_type *j_ptr)
                floor_item_optimize(0 - item);
        }
 
-       /* Sound */
        sound(SOUND_SHOOT);
-
-       /* Hack -- Handle stuff */
        handle_stuff();
 
        /* Save the old location */
@@ -3051,10 +2900,8 @@ void do_cmd_fire_aux(int item, object_type *j_ptr)
                {
                        cave[ny][nx].info |= (CAVE_GLOW);
 
-                       /* Notice */
                        note_spot(ny, nx);
 
-                       /* Redraw */
                        lite_spot(ny, nx);
                }
 
@@ -3092,10 +2939,8 @@ void do_cmd_fire_aux(int item, object_type *j_ptr)
                {
                        cave[ny][nx].info &= ~(CAVE_GLOW | CAVE_MARK);
 
-                       /* Notice */
                        note_spot(ny, nx);
 
-                       /* Redraw */
                        lite_spot(ny, nx);
                }
 
@@ -3178,7 +3023,6 @@ void do_cmd_fire_aux(int item, object_type *j_ptr)
                                        /* Get "the monster" or "it" */
                                        monster_desc(m_name, m_ptr, 0);
 
-                                       /* Message */
                                        msg_format(_("%sが%sに命中した。", "The %s hits %s."), o_name, m_name);
 
                                        if (m_ptr->ml)
@@ -3208,7 +3052,7 @@ void do_cmd_fire_aux(int item, object_type *j_ptr)
                                }
                                else
                                {
-                                       /* Apply special damage XXX XXX XXX */
+                                       /* Apply special damage */
                                        tdam = tot_dam_aux_shot(q_ptr, tdam, m_ptr);
                                        tdam = critical_shot(q_ptr->weight, q_ptr->to_h, j_ptr->to_h, tdam);
 
@@ -3238,10 +3082,8 @@ void do_cmd_fire_aux(int item, object_type *j_ptr)
                                {
                                        cave[ny][nx].info |= (CAVE_GLOW);
 
-                                       /* Notice */
                                        note_spot(ny, nx);
 
-                                       /* Redraw */
                                        lite_spot(ny, nx);
                                }
 
@@ -3266,7 +3108,6 @@ void do_cmd_fire_aux(int item, object_type *j_ptr)
                                                msg_format(_("%sは%sに突き刺さった!", "%^s have stuck into %s!"),o_name, m_name);
                                        }
 
-                                       /* Message */
                                        message_pain(c_mon_ptr->m_idx, tdam);
 
                                        /* Anger the monster */
@@ -3277,13 +3118,11 @@ void do_cmd_fire_aux(int item, object_type *j_ptr)
                                        {
                                                char m_name[80];
 
-                                               /* Sound */
                                                sound(SOUND_FLEE);
 
                                                /* Get the monster name (or "it") */
                                                monster_desc(m_name, m_ptr, 0);
 
-                                               /* Message */
                                                msg_format(_("%^sは恐怖して逃げ出した!", "%^s flees in terror!"), m_name);
                                        }
 
@@ -3321,7 +3160,7 @@ void do_cmd_fire_aux(int item, object_type *j_ptr)
                                                        m_ptr->fy = ny;
 
                                                        /* Update the monster (new location) */
-                                                       update_mon(c_mon_ptr->m_idx, TRUE);
+                                                       update_monster(c_mon_ptr->m_idx, TRUE);
 
                                                        lite_spot(ny, nx);
                                                        lite_spot(oy, ox);
@@ -3358,7 +3197,7 @@ void do_cmd_fire_aux(int item, object_type *j_ptr)
        {
                MONSTER_IDX m_idx = cave[y][x].m_idx;
                monster_type *m_ptr = &m_list[m_idx];
-               IDX o_idx = o_pop();
+               OBJECT_IDX o_idx = o_pop();
 
                if (!o_idx)
                {
@@ -3452,7 +3291,6 @@ void do_cmd_fire(void)
        /* Require proper missile */
        item_tester_tval = p_ptr->tval_ammo;
 
-       /* Get an item */
        q = _("どれを撃ちますか? ", "Fire which item? ");
        s = _("発射されるアイテムがありません。", "You have nothing to fire.");
        if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR)))
@@ -3500,8 +3338,9 @@ bool do_cmd_throw(int mult, bool boomerang, OBJECT_IDX shuriken)
 {
        DIRECTION dir;
        OBJECT_IDX item;
-       int i, y, x, ty, tx, prev_y, prev_x;
-       int ny[19], nx[19];
+       int i;
+       POSITION y, x, ty, tx, prev_y, prev_x;
+       POSITION ny[19], nx[19];
        int chance, tdam, tdis;
        int mul, div, dd, ds;
        int cur_dis, visible;
@@ -3521,7 +3360,7 @@ bool do_cmd_throw(int mult, bool boomerang, OBJECT_IDX shuriken)
 
        int msec = delay_factor * delay_factor * delay_factor;
 
-       u32b flgs[TR_FLAG_SIZE];
+       BIT_FLAGS flgs[TR_FLAG_SIZE];
        cptr q, s;
        bool come_back = FALSE;
        bool do_drop = TRUE;
@@ -3554,7 +3393,6 @@ bool do_cmd_throw(int mult, bool boomerang, OBJECT_IDX shuriken)
        }
        else
        {
-               /* Get an item */
                q = _("どのアイテムを投げますか? ", "Throw which item? ");
                s = _("投げるアイテムがない。", "You have nothing to throw.");
                if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR | USE_EQUIP)))
@@ -3574,14 +3412,11 @@ bool do_cmd_throw(int mult, bool boomerang, OBJECT_IDX shuriken)
                o_ptr = &o_list[0 - item];
        }
 
-
        /* Item is cursed */
        if (object_is_cursed(o_ptr) && (item >= INVEN_RARM))
        {
-               /* Oops */
                msg_print(_("ふーむ、どうやら呪われているようだ。", "Hmmm, it seems to be cursed."));
 
-               /* Nope */
                return FALSE;
        }
 
@@ -3592,13 +3427,10 @@ bool do_cmd_throw(int mult, bool boomerang, OBJECT_IDX shuriken)
                        msg_print(_("アリーナではアイテムを使えない!", "You're in the arena now. This is hand-to-hand!"));
                        msg_print(NULL);
 
-                       /* Nope */
                        return FALSE;
                }
 
        }
-
-       /* Get local object */
        q_ptr = &forge;
 
        /* Obtain a local object */
@@ -3684,7 +3516,6 @@ bool do_cmd_throw(int mult, bool boomerang, OBJECT_IDX shuriken)
                p_ptr->redraw |= (PR_EQUIPPY);
        }
 
-       /* Take a turn */
        p_ptr->energy_use = 100;
 
        /* Rogue and Ninja gets bonus */
@@ -3695,8 +3526,6 @@ bool do_cmd_throw(int mult, bool boomerang, OBJECT_IDX shuriken)
        y = p_ptr->y;
        x = p_ptr->x;
 
-
-       /* Hack -- Handle stuff */
        handle_stuff();
 
        if ((p_ptr->pclass == CLASS_NINJA) && ((q_ptr->tval == TV_SPIKE) || ((have_flag(flgs, TR_THROW)) && (q_ptr->tval == TV_SWORD)))) shuriken = TRUE;
@@ -3768,7 +3597,6 @@ bool do_cmd_throw(int mult, bool boomerang, OBJECT_IDX shuriken)
                if (cave[y][x].m_idx)
                {
                        cave_type *c_ptr = &cave[y][x];
-
                        monster_type *m_ptr = &m_list[c_ptr->m_idx];
 
                        /* Check the visibility */
@@ -3797,7 +3625,6 @@ bool do_cmd_throw(int mult, bool boomerang, OBJECT_IDX shuriken)
                                        /* Get "the monster" or "it" */
                                        monster_desc(m_name, m_ptr, 0);
 
-                                       /* Message */
                                        msg_format(_("%sが%sに命中した。", "The %s hits %s."), o_name, m_name);
 
                                        if (m_ptr->ml)
@@ -3815,7 +3642,7 @@ bool do_cmd_throw(int mult, bool boomerang, OBJECT_IDX shuriken)
                                ds = q_ptr->ds;
                                torch_dice(q_ptr, &dd, &ds); /* throwing a torch */
                                tdam = damroll(dd, ds);
-                               /* Apply special damage XXX XXX XXX */
+                               /* Apply special damage */
                                tdam = tot_dam_aux(q_ptr, tdam, m_ptr, 0, TRUE);
                                tdam = critical_shot(q_ptr->weight, q_ptr->to_h, 0, tdam);
                                if (q_ptr->to_d > 0)
@@ -3860,7 +3687,6 @@ bool do_cmd_throw(int mult, bool boomerang, OBJECT_IDX shuriken)
                                /* No death */
                                else
                                {
-                                       /* Message */
                                        message_pain(c_ptr->m_idx, tdam);
 
                                        /* Anger the monster */
@@ -3872,13 +3698,11 @@ bool do_cmd_throw(int mult, bool boomerang, OBJECT_IDX shuriken)
                                        {
                                                char m_name[80];
 
-                                               /* Sound */
                                                sound(SOUND_FLEE);
 
                                                /* Get the monster name (or "it") */
                                                monster_desc(m_name, m_ptr, 0);
 
-                                               /* Message */
                                                msg_format(_("%^sは恐怖して逃げ出した!", "%^s flees in terror!"), m_name);
                                        }
                                }
@@ -3914,7 +3738,6 @@ bool do_cmd_throw(int mult, bool boomerang, OBJECT_IDX shuriken)
        {
                if (hit_body || hit_wall || (randint1(100) < j))
                {
-                       /* Message */
                        msg_format(_("%sは砕け散った!", "The %s shatters!"), o_name);
 
                        if (potion_smash_effect(0, y, x, q_ptr->k_idx))
@@ -4024,7 +3847,6 @@ bool do_cmd_throw(int mult, bool boomerang, OBJECT_IDX shuriken)
                        /* Recalculate mana XXX */
                        p_ptr->update |= (PU_MANA);
 
-                       /* Window stuff */
                        p_ptr->window |= (PW_EQUIP);
                }
                else
@@ -4075,7 +3897,7 @@ static POSITION temp2_y[MAX_SHORT];
  */
 void forget_travel_flow(void)
 {
-       int x, y;
+       POSITION x, y;
 
        /* Check the entire dungeon */
        for (y = 0; y < cur_hgt; y++)
@@ -4096,7 +3918,7 @@ void forget_travel_flow(void)
  * @param x 該当地点のX座標
  * @return コスト値
  */
-static int travel_flow_cost(int y, int x)
+static int travel_flow_cost(POSITION y, POSITION x)
 {
        feature_type *f_ptr = &f_info[cave[y][x].feat];
        int cost = 1;
@@ -4196,9 +4018,9 @@ static void travel_flow_aux(POSITION y, POSITION x, int n, bool wall)
  * @param tx 目標地点のX座標
  * @return なし
  */
-static void travel_flow(int ty, int tx)
+static void travel_flow(POSITION ty, POSITION tx)
 {
-       int x, y, d;
+       POSITION x, y, d;
        bool wall = FALSE;
        feature_type *f_ptr = &f_info[cave[p_ptr->y][p_ptr->x].feat];