OSDN Git Service

[Refactor] #38993 m_list と max_m_idx を floor_type に取り込む。 / Move m_list and max_m_idx...
[hengband/hengband.git] / src / cmd2.c
index 6a7e2d0..cc71a85 100644 (file)
 #include "object-hook.h"
 #include "projection.h"
 #include "spells-summon.h"
+#include "spells-status.h"
 #include "monster-status.h"
+#include "quest.h"
+#include "artifact.h"
+#include "avatar.h"
+#include "player-status.h"
+#include "realm-hex.h"
+#include "geometry.h"
+#include "wild.h"
+#include "grid.h"
+#include "feature.h"
 
 /*!
  * @brief フロア脱出時に出戻りが不可能だった場合に警告を加える処理
  * @param down_stair TRUEならば階段を降りる処理、FALSEなら階段を昇る処理による内容
  * @return フロア移動を実際に行うならTRUE、キャンセルする場合はFALSE
  */
-bool confirm_leave_level(bool down_stair)
+static bool confirm_leave_level(bool down_stair)
 {
        quest_type *q_ptr = &quest[p_ptr->inside_quest];
 
@@ -48,6 +58,80 @@ bool confirm_leave_level(bool down_stair)
 }
 
 /*!
+ * @brief 魔法系コマンドが制限されているかを返す。
+ * @return 魔法系コマンドを使用可能ならFALSE、不可能ならば理由をメッセージ表示してTRUEを返す。
+ */
+bool cmd_limit_cast(player_type *creature_ptr)
+{
+       if (current_floor_ptr->dun_level && (d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_MAGIC))
+       {
+               msg_print(_("ダンジョンが魔法を吸収した!", "The dungeon absorbs all attempted magic!"));
+               msg_print(NULL);
+               return TRUE;
+       }
+       else if (creature_ptr->anti_magic)
+       {
+               msg_print(_("反魔法バリアが魔法を邪魔した!", "An anti-magic shell disrupts your magic!"));
+               return TRUE;
+       }
+       else if (creature_ptr->shero)
+       {
+               msg_format(_("狂戦士化していて頭が回らない!", "You cannot think directly!"));
+               return TRUE;
+       }
+       else
+               return FALSE;
+}
+
+bool cmd_limit_confused(player_type *creature_ptr)
+{
+       if (creature_ptr->confused)
+       {
+               msg_print(_("混乱していてできない!", "You are too confused!"));
+               return TRUE;
+       }
+       return FALSE;
+}
+
+bool cmd_limit_arena(player_type *creature_ptr)
+{
+       if (creature_ptr->inside_arena)
+       {
+               msg_print(_("アリーナが魔法を吸収した!", "The arena absorbs all attempted magic!"));
+               msg_print(NULL);
+               return TRUE;
+       }
+       return FALSE;
+}
+
+bool cmd_limit_blind(player_type *creature_ptr)
+{
+       if (creature_ptr->blind)
+       {
+               msg_print(_("目が見えない。", "You can't see anything."));
+               return TRUE;
+       }
+       if (no_lite())
+       {
+               msg_print(_("明かりがないので、暗くて読めない。", "You have no light to read by."));
+               return TRUE;
+       }
+       return FALSE;
+}
+
+bool cmd_limit_time_walk(player_type *creature_ptr)
+{
+       if (creature_ptr->timewalk)
+       {
+               if (flush_failure) flush();
+               msg_print(_("止まった時の中ではうまく働かないようだ。", "It shows no reaction."));
+               sound(SOUND_FAIL);
+               return TRUE;
+       }
+       return FALSE;
+}
+
+/*!
  * @brief 階段を使って階層を昇る処理 / Go up one level
  * @return なし
  */
@@ -56,8 +140,8 @@ void do_cmd_go_up(void)
        bool go_up = FALSE;
 
        /* Player grid */
-       cave_type *c_ptr = &cave[p_ptr->y][p_ptr->x];
-       feature_type *f_ptr = &f_info[c_ptr->feat];
+       grid_type *g_ptr = &current_floor_ptr->grid_array[p_ptr->y][p_ptr->x];
+       feature_type *f_ptr = &f_info[g_ptr->feat];
 
        int up_num = 0;
 
@@ -88,7 +172,7 @@ void do_cmd_go_up(void)
 
                leave_quest_check();
 
-               p_ptr->inside_quest = c_ptr->special;
+               p_ptr->inside_quest = g_ptr->special;
 
                /* Activate the quest */
                if (!quest[p_ptr->inside_quest].status)
@@ -104,7 +188,7 @@ void do_cmd_go_up(void)
                /* Leaving a quest */
                if (!p_ptr->inside_quest)
                {
-                       dun_level = 0;
+                       current_floor_ptr->dun_level = 0;
                }
 
                /* Leaving */
@@ -113,14 +197,13 @@ void do_cmd_go_up(void)
                p_ptr->oldpx = 0;
                p_ptr->oldpy = 0;
                
-               /* Hack -- take a turn */
-               p_ptr->energy_use = 100;
+               take_turn(p_ptr, 100);
 
                /* End the command */
                return;
        }
 
-       if (!dun_level)
+       if (!current_floor_ptr->dun_level)
        {
                go_up = TRUE;
        }
@@ -132,8 +215,7 @@ void do_cmd_go_up(void)
        /* Cancel the command */
        if (!go_up) return;
 
-       /* Hack -- take a turn */
-       p_ptr->energy_use = 100;
+       take_turn(p_ptr, 100);
 
        if (autosave_l) do_cmd_save_game(TRUE);
 
@@ -152,8 +234,8 @@ void do_cmd_go_up(void)
        {
                leave_quest_check();
 
-               p_ptr->inside_quest = c_ptr->special;
-               dun_level = 0;
+               p_ptr->inside_quest = g_ptr->special;
+               current_floor_ptr->dun_level = 0;
                up_num = 0;
        }
 
@@ -177,15 +259,15 @@ void do_cmd_go_up(void)
                }
 
                /* Get out from current dungeon */
-               if (dun_level - up_num < d_info[dungeon_type].mindepth)
-                       up_num = dun_level;
+               if (current_floor_ptr->dun_level - up_num < d_info[p_ptr->dungeon_idx].mindepth)
+                       up_num = current_floor_ptr->dun_level;
        }
        if (record_stair) do_cmd_write_nikki(NIKKI_STAIR, 0-up_num, _("階段を上った", "climbed up the stairs to"));
 
        /* Success */
        if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (inventory[INVEN_BOW].name1 == ART_CRIMSON))
                msg_print(_("なんだこの階段は!", "What's this STAIRWAY!"));
-       else if (up_num == dun_level)
+       else if (up_num == current_floor_ptr->dun_level)
                msg_print(_("地上に戻った。", "You go back to the surface."));
        else
                msg_print(_("階段を上って新たなる迷宮へと足を踏み入れた。", "You enter a maze of up staircases."));
@@ -202,8 +284,8 @@ void do_cmd_go_up(void)
 void do_cmd_go_down(void)
 {
        /* Player grid */
-       cave_type *c_ptr = &cave[p_ptr->y][p_ptr->x];
-       feature_type *f_ptr = &f_info[c_ptr->feat];
+       grid_type *g_ptr = &current_floor_ptr->grid_array[p_ptr->y][p_ptr->x];
+       feature_type *f_ptr = &f_info[g_ptr->feat];
 
        bool fall_trap = FALSE;
        int down_num = 0;
@@ -242,7 +324,7 @@ void do_cmd_go_down(void)
                leave_quest_check();
                leave_tower_check();
 
-               p_ptr->inside_quest = c_ptr->special;
+               p_ptr->inside_quest = g_ptr->special;
 
                /* Activate the quest */
                if (!quest[p_ptr->inside_quest].status)
@@ -258,27 +340,24 @@ void do_cmd_go_down(void)
                /* Leaving a quest */
                if (!p_ptr->inside_quest)
                {
-                       dun_level = 0;
+                       current_floor_ptr->dun_level = 0;
                }
 
                /* Leaving */
                p_ptr->leaving = TRUE;
-
                p_ptr->oldpx = 0;
                p_ptr->oldpy = 0;
                
-               
-        /* Hack -- take a turn */
-        p_ptr->energy_use = 100;
+               take_turn(p_ptr, 100);
        }
 
        else
        {
                DUNGEON_IDX target_dungeon = 0;
 
-               if (!dun_level)
+               if (!current_floor_ptr->dun_level)
                {
-                       target_dungeon = have_flag(f_ptr->flags, FF_ENTRANCE) ? c_ptr->special : DUNGEON_ANGBAND;
+                       target_dungeon = have_flag(f_ptr->flags, FF_ENTRANCE) ? g_ptr->special : DUNGEON_ANGBAND;
 
                        if (ironman_downward && (target_dungeon != DUNGEON_ANGBAND))
                        {
@@ -295,7 +374,7 @@ void do_cmd_go_down(void)
                        /* Save old player position */
                        p_ptr->oldpx = p_ptr->x;
                        p_ptr->oldpy = p_ptr->y;
-                       dungeon_type = target_dungeon;
+                       p_ptr->dungeon_idx = target_dungeon;
 
                        /*
                         * Clear all saved floors
@@ -304,8 +383,7 @@ void do_cmd_go_down(void)
                        prepare_change_floor_mode(CFM_FIRST_FLOOR);
                }
 
-               /* Hack -- take a turn */
-               p_ptr->energy_use = 100;
+               take_turn(p_ptr, 100);
 
                if (autosave_l) do_cmd_save_game(TRUE);
 
@@ -313,11 +391,11 @@ void do_cmd_go_down(void)
                if (have_flag(f_ptr->flags, FF_SHAFT)) down_num += 2;
                else down_num += 1;
 
-               if (!dun_level)
+               if (!current_floor_ptr->dun_level)
                {
                        /* Enter the dungeon just now */
                        p_ptr->enter_dungeon = TRUE;
-                       down_num = d_info[dungeon_type].mindepth;
+                       down_num = d_info[p_ptr->dungeon_idx].mindepth;
                }
 
                if (record_stair)
@@ -335,7 +413,7 @@ void do_cmd_go_down(void)
                        /* Success */
                        if (target_dungeon)
                        {
-                               msg_format(_("%sへ入った。", "You entered %s."), d_text + d_info[dungeon_type].text);
+                               msg_format(_("%sへ入った。", "You entered %s."), d_text + d_info[p_ptr->dungeon_idx].text);
                        }
                        else
                        {
@@ -387,7 +465,7 @@ void do_cmd_search(void)
                /* Cancel the arg */
                command_arg = 0;
        }
-       p_ptr->energy_use = 100;
+       take_turn(p_ptr, 100);
 
        /* Search */
        search();
@@ -403,15 +481,15 @@ void do_cmd_search(void)
  */
 static OBJECT_IDX chest_check(POSITION y, POSITION x, bool trapped)
 {
-       cave_type *c_ptr = &cave[y][x];
+       grid_type *g_ptr = &current_floor_ptr->grid_array[y][x];
        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)
+       for (this_o_idx = g_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
        {
                object_type *o_ptr;
 
-               o_ptr = &o_list[this_o_idx];
+               o_ptr = &current_floor_ptr->o_list[this_o_idx];
                next_o_idx = o_ptr->next_o_idx;
 
                /* Skip unknown chests XXX XXX */
@@ -443,9 +521,9 @@ 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];
+       object_type *o_ptr = &current_floor_ptr->o_list[o_idx];
 
-       p_ptr->energy_use = 100;
+       take_turn(p_ptr, 100);
 
        /* Attempt to unlock it */
        if (o_ptr->pval > 0)
@@ -498,18 +576,6 @@ static bool do_cmd_open_chest(POSITION y, POSITION x, OBJECT_IDX o_idx)
 }
 
 /*!
- * @brief 地形は開くものであって、かつ開かれているかを返す /
- * Attempt to open the given chest at the given location
- * @param feat 地形ID
- * @return 開いた地形である場合TRUEを返す /  Return TRUE if the given feature is an open door
- */
-static bool is_open(IDX feat)
-{
-       return have_flag(f_info[feat].flags, FF_CLOSE) && (feat != feat_state(feat, FF_CLOSE));
-}
-
-
-/*!
  * @brief プレイヤーの周辺9マスに該当する地形がいくつあるかを返す /
  * Attempt to open the given chest at the given location
  * @param y 該当する地形の中から1つのY座標を返す参照ポインタ
@@ -522,7 +588,9 @@ static bool is_open(IDX feat)
  */
 static int count_dt(POSITION *y, POSITION *x, bool (*test)(IDX feat), bool under)
 {
-       int d, count, xx, yy;
+       DIRECTION d;
+       int count;
+       POSITION xx, yy;
 
        /* Count how many matches */
        count = 0;
@@ -530,7 +598,7 @@ static int count_dt(POSITION *y, POSITION *x, bool (*test)(IDX feat), bool under
        /* Check around (and under) the character */
        for (d = 0; d < 9; d++)
        {
-               cave_type *c_ptr;
+               grid_type *g_ptr;
                FEAT_IDX feat;
 
                /* if not searching under player continue */
@@ -540,14 +608,14 @@ static int count_dt(POSITION *y, POSITION *x, bool (*test)(IDX feat), bool under
                yy = p_ptr->y + ddy_ddd[d];
                xx = p_ptr->x + ddx_ddd[d];
 
-               /* Get the cave */
-               c_ptr = &cave[yy][xx];
+               /* Get the current_floor_ptr->grid_array */
+               g_ptr = &current_floor_ptr->grid_array[yy][xx];
 
                /* Must have knowledge */
-               if (!(c_ptr->info & (CAVE_MARK))) continue;
+               if (!(g_ptr->info & (CAVE_MARK))) continue;
 
                /* Feature code (applying "mimic" field) */
-               feat = get_feat_mimic(c_ptr);
+               feat = get_feat_mimic(g_ptr);
 
                /* Not looking for this feature */
                if (!((*test)(feat))) continue;
@@ -577,9 +645,9 @@ 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;
+       DIRECTION d;
+       int count;
        OBJECT_IDX o_idx;
-
        object_type *o_ptr;
 
        /* Count how many matches */
@@ -596,7 +664,7 @@ static int count_chests(POSITION *y, POSITION *x, bool trapped)
                if ((o_idx = chest_check(yy, xx, FALSE)) == 0) continue;
 
                /* Grab the object */
-               o_ptr = &o_list[o_idx];
+               o_ptr = &current_floor_ptr->o_list[o_idx];
 
                /* Already open */
                if (o_ptr->pval == 0) continue;
@@ -618,26 +686,6 @@ static int count_chests(POSITION *y, POSITION *x, bool trapped)
 }
 
 
-/*!
- * @brief プレイヤーから指定の座標がどの方角にあるかを返す /
- * Convert an adjacent location to a direction.
- * @param y 方角を確認したY座標
- * @param x 方角を確認したX座標
- * @return 方向ID
- */
-static DIRECTION coords_to_dir(POSITION y, POSITION x)
-{
-       int d[3][3] = { {7, 4, 1}, {8, 5, 2}, {9, 6, 3} };
-       int dy, dx;
-
-       dy = y - p_ptr->y;
-       dx = x - p_ptr->x;
-
-       /* Paranoia */
-       if (ABS(dx) > 1 || ABS(dy) > 1) return (0);
-
-       return d[dx + 1][dy + 1];
-}
 
 /*!
  * @brief 「開ける」動作コマンドのサブルーチン /
@@ -655,11 +703,11 @@ 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];
+       grid_type *g_ptr = &current_floor_ptr->grid_array[y][x];
+       feature_type *f_ptr = &f_info[g_ptr->feat];
        bool more = FALSE;
 
-       p_ptr->energy_use = 100;
+       take_turn(p_ptr, 100);
 
        /* Seeing true feature code (ignore mimic) */
 
@@ -667,7 +715,7 @@ static bool do_cmd_open_aux(POSITION y, POSITION x)
        if (!have_flag(f_ptr->flags, FF_OPEN))
        {
                /* Stuck */
-               msg_format(_("%sはがっちりと閉じられているようだ。", "The %s appears to be stuck."), f_name + f_info[get_feat_mimic(c_ptr)].name);
+               msg_format(_("%sはがっちりと閉じられているようだ。", "The %s appears to be stuck."), f_name + f_info[get_feat_mimic(g_ptr)].name);
        }
 
        /* Locked door */
@@ -784,17 +832,17 @@ void do_cmd_open(void)
        if (get_rep_dir(&dir, TRUE))
        {
                FEAT_IDX feat;
-               cave_type *c_ptr;
+               grid_type *g_ptr;
 
                /* Get requested location */
                y = p_ptr->y + ddy[dir];
                x = p_ptr->x + ddx[dir];
 
                /* Get requested grid */
-               c_ptr = &cave[y][x];
+               g_ptr = &current_floor_ptr->grid_array[y][x];
 
                /* Feature code (applying "mimic" field) */
-               feat = get_feat_mimic(c_ptr);
+               feat = get_feat_mimic(g_ptr);
 
                /* Check for chest */
                o_idx = chest_check(y, x, FALSE);
@@ -806,9 +854,9 @@ void do_cmd_open(void)
                }
 
                /* Monster in the way */
-               else if (c_ptr->m_idx && p_ptr->riding != c_ptr->m_idx)
+               else if (g_ptr->m_idx && p_ptr->riding != g_ptr->m_idx)
                {
-                       p_ptr->energy_use = 100;
+                       take_turn(p_ptr, 100);
                        msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
                        py_attack(y, x, 0);
                }
@@ -847,11 +895,11 @@ void do_cmd_open(void)
  */
 static bool do_cmd_close_aux(POSITION y, POSITION x)
 {
-       cave_type *c_ptr = &cave[y][x];
-       FEAT_IDX old_feat = c_ptr->feat;
+       grid_type *g_ptr = &current_floor_ptr->grid_array[y][x];
+       FEAT_IDX old_feat = g_ptr->feat;
        bool more = FALSE;
 
-       p_ptr->energy_use = 100;
+       take_turn(p_ptr, 100);
 
        /* Seeing true feature code (ignore mimic) */
 
@@ -861,7 +909,7 @@ static bool do_cmd_close_aux(POSITION y, POSITION x)
                s16b closed_feat = feat_state(old_feat, FF_CLOSE);
 
                /* Hack -- object in the way */
-               if ((c_ptr->o_idx || (c_ptr->info & CAVE_OBJECT)) &&
+               if ((g_ptr->o_idx || (g_ptr->info & CAVE_OBJECT)) &&
                    (closed_feat != old_feat) && !have_flag(f_info[closed_feat].flags, FF_DROP))
                {
                        msg_print(_("何かがつっかえて閉まらない。", "There seems stuck."));
@@ -872,7 +920,7 @@ static bool do_cmd_close_aux(POSITION y, POSITION x)
                        cave_alter_feat(y, x, FF_CLOSE);
 
                        /* Broken door */
-                       if (old_feat == c_ptr->feat)
+                       if (old_feat == g_ptr->feat)
                        {
                                msg_print(_("ドアは壊れてしまっている。", "The door appears to be broken."));
                        }
@@ -931,15 +979,15 @@ void do_cmd_close(void)
        /* Get a "repeated" direction */
        if (get_rep_dir(&dir, FALSE))
        {
-               cave_type *c_ptr;
+               grid_type *g_ptr;
                FEAT_IDX feat;
 
                y = p_ptr->y + ddy[dir];
                x = p_ptr->x + ddx[dir];
-               c_ptr = &cave[y][x];
+               g_ptr = &current_floor_ptr->grid_array[y][x];
 
                /* Feature code (applying "mimic" field) */
-               feat = get_feat_mimic(c_ptr);
+               feat = get_feat_mimic(g_ptr);
 
                /* Require open/broken door */
                if (!have_flag(f_info[feat].flags, FF_CLOSE))
@@ -948,9 +996,9 @@ void do_cmd_close(void)
                }
 
                /* Monster in the way */
-               else if (c_ptr->m_idx)
+               else if (g_ptr->m_idx)
                {
-                       p_ptr->energy_use = 100;
+                       take_turn(p_ptr, 100);
 
                        msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
 
@@ -980,10 +1028,10 @@ void do_cmd_close(void)
  */
 static bool do_cmd_tunnel_test(POSITION y, POSITION x)
 {
-       cave_type *c_ptr = &cave[y][x];
+       grid_type *g_ptr = &current_floor_ptr->grid_array[y][x];
 
        /* Must have knowledge */
-       if (!(c_ptr->info & CAVE_MARK))
+       if (!(g_ptr->info & CAVE_MARK))
        {
                msg_print(_("そこには何も見当たらない。", "You see nothing there."));
 
@@ -991,7 +1039,7 @@ static bool do_cmd_tunnel_test(POSITION y, POSITION x)
        }
 
        /* Must be a wall/door/etc */
-       if (!cave_have_flag_grid(c_ptr, FF_TUNNEL))
+       if (!cave_have_flag_grid(g_ptr, FF_TUNNEL))
        {
                msg_print(_("そこには掘るものが見当たらない。", "You see nothing there to tunnel."));
 
@@ -1015,7 +1063,7 @@ static bool do_cmd_tunnel_test(POSITION y, POSITION x)
  */
 static bool do_cmd_tunnel_aux(POSITION y, POSITION x)
 {
-       cave_type *c_ptr;
+       grid_type *g_ptr;
        feature_type *f_ptr, *mimic_f_ptr;
        int power;
        concptr name;
@@ -1024,15 +1072,14 @@ static bool do_cmd_tunnel_aux(POSITION y, POSITION x)
        /* Verify legality */
        if (!do_cmd_tunnel_test(y, x)) return (FALSE);
 
-       p_ptr->energy_use = 100;
+       take_turn(p_ptr, 100);
 
-       /* Get grid */
-       c_ptr = &cave[y][x];
-       f_ptr = &f_info[c_ptr->feat];
+       g_ptr = &current_floor_ptr->grid_array[y][x];
+       f_ptr = &f_info[g_ptr->feat];
        power = f_ptr->power;
 
        /* Feature code (applying "mimic" field) */
-       mimic_f_ptr = &f_info[get_feat_mimic(c_ptr)];
+       mimic_f_ptr = &f_info[get_feat_mimic(g_ptr)];
 
        name = f_name + mimic_f_ptr->name;
 
@@ -1119,7 +1166,7 @@ static bool do_cmd_tunnel_aux(POSITION y, POSITION x)
                }
        }
 
-       if (is_hidden_door(c_ptr))
+       if (is_hidden_door(g_ptr))
        {
                /* Occasional Search XXX XXX */
                if (randint0(100) < 25) search();
@@ -1143,13 +1190,12 @@ static bool do_cmd_tunnel_aux(POSITION y, POSITION x)
  */
 void do_cmd_tunnel(void)
 {
-       int                     y, x, dir;
-
-       cave_type       *c_ptr;
+       POSITION y, x;
+       DIRECTION dir;
+       grid_type *g_ptr;
        FEAT_IDX feat;
 
-       bool            more = FALSE;
-
+       bool more = FALSE;
 
        if (p_ptr->special_defense & KATA_MUSOU)
        {
@@ -1174,11 +1220,10 @@ void do_cmd_tunnel(void)
                y = p_ptr->y + ddy[dir];
                x = p_ptr->x + ddx[dir];
 
-               /* Get grid */
-               c_ptr = &cave[y][x];
+               g_ptr = &current_floor_ptr->grid_array[y][x];
 
                /* Feature code (applying "mimic" field) */
-               feat = get_feat_mimic(c_ptr);
+               feat = get_feat_mimic(g_ptr);
 
                /* No tunnelling through doors */
                if (have_flag(f_info[feat].flags, FF_DOOR))
@@ -1193,9 +1238,9 @@ void do_cmd_tunnel(void)
                }
 
                /* A monster is in the way */
-               else if (c_ptr->m_idx)
+               else if (g_ptr->m_idx)
                {
-                       p_ptr->energy_use = 100;
+                       take_turn(p_ptr, 100);
 
                        msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
 
@@ -1233,11 +1278,11 @@ bool easy_open_door(POSITION y, POSITION x)
 {
        int i, j;
 
-       cave_type *c_ptr = &cave[y][x];
-       feature_type *f_ptr = &f_info[c_ptr->feat];
+       grid_type *g_ptr = &current_floor_ptr->grid_array[y][x];
+       feature_type *f_ptr = &f_info[g_ptr->feat];
 
        /* Must be a closed door */
-       if (!is_closed_door(c_ptr->feat))
+       if (!is_closed_door(g_ptr->feat))
        {
                return (FALSE);
        }
@@ -1246,7 +1291,7 @@ bool easy_open_door(POSITION y, POSITION x)
        if (!have_flag(f_ptr->flags, FF_OPEN))
        {
                /* Stuck */
-               msg_format(_("%sはがっちりと閉じられているようだ。", "The %s appears to be stuck."), f_name + f_info[get_feat_mimic(c_ptr)].name);
+               msg_format(_("%sはがっちりと閉じられているようだ。", "The %s appears to be stuck."), f_name + f_info[get_feat_mimic(g_ptr)].name);
 
        }
 
@@ -1323,9 +1368,9 @@ 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];
+       object_type *o_ptr = &current_floor_ptr->o_list[o_idx];
 
-       p_ptr->energy_use = 100;
+       take_turn(p_ptr, 100);
 
        /* Get the "disarm" factor */
        i = p_ptr->skill_dis;
@@ -1404,10 +1449,10 @@ static bool do_cmd_disarm_chest(POSITION y, POSITION x, OBJECT_IDX o_idx)
 
 bool do_cmd_disarm_aux(POSITION y, POSITION x, DIRECTION dir)
 {
-       cave_type *c_ptr = &cave[y][x];
+       grid_type *g_ptr = &current_floor_ptr->grid_array[y][x];
 
        /* Get feature */
-       feature_type *f_ptr = &f_info[c_ptr->feat];
+       feature_type *f_ptr = &f_info[g_ptr->feat];
 
        /* Access trap name */
        concptr name = (f_name + f_ptr->name);
@@ -1420,7 +1465,7 @@ bool do_cmd_disarm_aux(POSITION y, POSITION x, DIRECTION dir)
        int i = p_ptr->skill_dis;
        int j;
 
-       p_ptr->energy_use = 100;
+       take_turn(p_ptr, 100);
 
        /* Penalize some conditions */
        if (p_ptr->blind || no_lite()) i = i / 10;
@@ -1524,15 +1569,15 @@ void do_cmd_disarm(void)
        /* Get a direction (or abort) */
        if (get_rep_dir(&dir,TRUE))
        {
-               cave_type *c_ptr;
+               grid_type *g_ptr;
                FEAT_IDX feat;
 
                y = p_ptr->y + ddy[dir];
                x = p_ptr->x + ddx[dir];
-               c_ptr = &cave[y][x];
+               g_ptr = &current_floor_ptr->grid_array[y][x];
 
                /* Feature code (applying "mimic" field) */
-               feat = get_feat_mimic(c_ptr);
+               feat = get_feat_mimic(g_ptr);
 
                /* Check for chests */
                o_idx = chest_check(y, x, TRUE);
@@ -1544,7 +1589,7 @@ void do_cmd_disarm(void)
                }
 
                /* Monster in the way */
-               else if (c_ptr->m_idx && p_ptr->riding != c_ptr->m_idx)
+               else if (g_ptr->m_idx && p_ptr->riding != g_ptr->m_idx)
                {
                        msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
 
@@ -1586,11 +1631,10 @@ void do_cmd_disarm(void)
  */
 static bool do_cmd_bash_aux(POSITION y, POSITION x, DIRECTION dir)
 {
-       /* Get grid */
-       cave_type       *c_ptr = &cave[y][x];
+       grid_type       *g_ptr = &current_floor_ptr->grid_array[y][x];
 
        /* Get feature */
-       feature_type *f_ptr = &f_info[c_ptr->feat];
+       feature_type *f_ptr = &f_info[g_ptr->feat];
 
        /* Hack -- Bash power based on strength */
        /* (Ranges from 3 to 20 to 100 to 200) */
@@ -1601,9 +1645,9 @@ static bool do_cmd_bash_aux(POSITION y, POSITION x, DIRECTION dir)
 
        bool            more = FALSE;
 
-       concptr name = f_name + f_info[get_feat_mimic(c_ptr)].name;
+       concptr name = f_name + f_info[get_feat_mimic(g_ptr)].name;
 
-       p_ptr->energy_use = 100;
+       take_turn(p_ptr, 100);
 
        msg_format(_("%sに体当たりをした!", "You smash into the %s!"), name);
 
@@ -1623,7 +1667,7 @@ static bool do_cmd_bash_aux(POSITION y, POSITION x, DIRECTION dir)
                sound(have_flag(f_ptr->flags, FF_GLASS) ? SOUND_GLASS : SOUND_OPENDOOR);
 
                /* Break down the door */
-               if ((randint0(100) < 50) || (feat_state(c_ptr->feat, FF_OPEN) == c_ptr->feat) || have_flag(f_ptr->flags, FF_GLASS))
+               if ((randint0(100) < 50) || (feat_state(g_ptr->feat, FF_OPEN) == g_ptr->feat) || have_flag(f_ptr->flags, FF_GLASS))
                {
                        cave_alter_feat(y, x, FF_BASH);
                }
@@ -1681,7 +1725,7 @@ static bool do_cmd_bash_aux(POSITION y, POSITION x, DIRECTION dir)
 void do_cmd_bash(void)
 {
        int     y, x, dir;
-       cave_type       *c_ptr;
+       grid_type       *g_ptr;
        bool            more = FALSE;
 
        if (p_ptr->wild_mode) return;
@@ -1711,11 +1755,10 @@ void do_cmd_bash(void)
                y = p_ptr->y + ddy[dir];
                x = p_ptr->x + ddx[dir];
 
-               /* Get grid */
-               c_ptr = &cave[y][x];
+               g_ptr = &current_floor_ptr->grid_array[y][x];
 
                /* Feature code (applying "mimic" field) */
-               feat = get_feat_mimic(c_ptr);
+               feat = get_feat_mimic(g_ptr);
 
                /* Nothing useful */
                if (!have_flag(f_info[feat].flags, FF_BASH))
@@ -1724,9 +1767,9 @@ void do_cmd_bash(void)
                }
 
                /* Monster in the way */
-               else if (c_ptr->m_idx)
+               else if (g_ptr->m_idx)
                {
-                       p_ptr->energy_use = 100;
+                       take_turn(p_ptr, 100);
 
                        msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
 
@@ -1766,7 +1809,7 @@ void do_cmd_alter(void)
 {
        POSITION y, x;
        DIRECTION dir;
-       cave_type *c_ptr;
+       grid_type *g_ptr;
        bool more = FALSE;
 
        if (p_ptr->special_defense & KATA_MUSOU)
@@ -1794,16 +1837,15 @@ void do_cmd_alter(void)
                y = p_ptr->y + ddy[dir];
                x = p_ptr->x + ddx[dir];
 
-               /* Get grid */
-               c_ptr = &cave[y][x];
+               g_ptr = &current_floor_ptr->grid_array[y][x];
 
                /* Feature code (applying "mimic" field) */
-               feat = get_feat_mimic(c_ptr);
+               feat = get_feat_mimic(g_ptr);
                f_ptr = &f_info[feat];
 
-               p_ptr->energy_use = 100;
+               take_turn(p_ptr, 100);
 
-               if (c_ptr->m_idx)
+               if (g_ptr->m_idx)
                {
                        py_attack(y, x, 0);
                }
@@ -1912,15 +1954,15 @@ void do_cmd_spike(void)
        {
                POSITION y, x;
                INVENTORY_IDX item;
-               cave_type *c_ptr;
+               grid_type *g_ptr;
                FEAT_IDX feat;
 
                y = p_ptr->y + ddy[dir];
                x = p_ptr->x + ddx[dir];
-               c_ptr = &cave[y][x];
+               g_ptr = &current_floor_ptr->grid_array[y][x];
 
                /* Feature code (applying "mimic" field) */
-               feat = get_feat_mimic(c_ptr);
+               feat = get_feat_mimic(g_ptr);
 
                /* Require closed door */
                if (!have_flag(f_info[feat].flags, FF_SPIKE))
@@ -1935,9 +1977,9 @@ void do_cmd_spike(void)
                }
 
                /* Is a monster in the way? */
-               else if (c_ptr->m_idx)
+               else if (g_ptr->m_idx)
                {
-                       p_ptr->energy_use = 100;
+                       take_turn(p_ptr, 100);
 
                        msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
 
@@ -1948,7 +1990,7 @@ void do_cmd_spike(void)
                /* Go for it */
                else
                {
-                       p_ptr->energy_use = 100;
+                       take_turn(p_ptr, 100);
 
                        /* Successful jamming */
                        msg_format(_("%sにくさびを打ち込んだ。", "You jam the %s with a spike."), f_name + f_info[feat].name);
@@ -1991,7 +2033,7 @@ void do_cmd_walk(bool pickup)
        /* Get a "repeated" direction */
        if (get_rep_dir(&dir, FALSE))
        {
-               p_ptr->energy_use = 100;
+               take_turn(p_ptr, 100);
 
                if ((dir != 5) && (p_ptr->special_defense & KATA_MUSOU))
                {
@@ -2026,7 +2068,7 @@ void do_cmd_walk(bool pickup)
                        change_wild_mode();
 
                        /* Give first move to monsters */
-                       p_ptr->energy_use = 100;
+                       take_turn(p_ptr, 100);
 
                        /* HACk -- set the encouter flag for the wilderness generation */
                        generate_encounter = TRUE;
@@ -2046,13 +2088,7 @@ void do_cmd_walk(bool pickup)
 void do_cmd_run(void)
 {
        DIRECTION dir;
-
-       /* Hack -- no running when confused */
-       if (p_ptr->confused)
-       {
-               msg_print(_("混乱していて走れない!", "You are too confused!"));
-               return;
-       }
+       if (cmd_limit_confused(p_ptr)) return;
 
        if (p_ptr->special_defense & KATA_MUSOU)
        {
@@ -2093,7 +2129,7 @@ void do_cmd_stay(bool pickup)
                command_arg = 0;
        }
 
-       p_ptr->energy_use = 100;
+       take_turn(p_ptr, 100);
 
        if (pickup) mpe_mode |= MPE_DO_PICKUP;
        (void)move_player_effect(p_ptr->y, p_ptr->x, mpe_mode);
@@ -2112,7 +2148,7 @@ void do_cmd_rest(void)
 
        if ((p_ptr->pclass == CLASS_BARD) && (SINGING_SONG_EFFECT(p_ptr) || INTERUPTING_SONG_EFFECT(p_ptr)))
        {
-               stop_singing();
+               stop_singing(p_ptr);
        }
 
        /* Hex */
@@ -2160,7 +2196,7 @@ void do_cmd_rest(void)
        if (p_ptr->special_defense & NINJA_S_STEALTH) set_superstealth(FALSE);
 
        /* Take a turn (?) */
-       p_ptr->energy_use = 100;
+       take_turn(p_ptr, 100);
 
        /* The sin of sloth */
        if (command_arg > 100) chg_virtue(V_DILIGENCE, -1);
@@ -2250,7 +2286,7 @@ void do_cmd_fire(void)
        }
 
        /* Fire the item */
-       do_cmd_fire_aux(item, j_ptr);
+       exe_fire(item, j_ptr);
 
        if (!is_fired || p_ptr->pclass != CLASS_SNIPER) return;
 
@@ -2328,7 +2364,7 @@ bool do_cmd_throw(int mult, bool boomerang, OBJECT_IDX shuriken)
        }
        else if (boomerang)
        {
-               if (buki_motteruka(INVEN_RARM) && buki_motteruka(INVEN_LARM))
+               if (has_melee_weapon(INVEN_RARM) && has_melee_weapon(INVEN_LARM))
                {
                        item_tester_hook = item_tester_hook_boomerang;
                        q = _("どの武器を投げますか? ", "Throw which item? ");
@@ -2340,7 +2376,7 @@ bool do_cmd_throw(int mult, bool boomerang, OBJECT_IDX shuriken)
                                return FALSE;
                        }
                }
-               else if (buki_motteruka(INVEN_LARM))
+               else if (has_melee_weapon(INVEN_LARM))
                {
                        item = INVEN_LARM;
                        o_ptr = &inventory[item];
@@ -2367,7 +2403,6 @@ bool do_cmd_throw(int mult, bool boomerang, OBJECT_IDX shuriken)
        if (object_is_cursed(o_ptr) && (item >= INVEN_RARM))
        {
                msg_print(_("ふーむ、どうやら呪われているようだ。", "Hmmm, it seems to be cursed."));
-
                return FALSE;
        }
 
@@ -2466,7 +2501,7 @@ bool do_cmd_throw(int mult, bool boomerang, OBJECT_IDX shuriken)
                p_ptr->redraw |= (PR_EQUIPPY);
        }
 
-       p_ptr->energy_use = 100;
+       take_turn(p_ptr, 100);
 
        /* Rogue and Ninja gets bonus */
        if ((p_ptr->pclass == CLASS_ROGUE) || (p_ptr->pclass == CLASS_NINJA))
@@ -2488,7 +2523,6 @@ bool do_cmd_throw(int mult, bool boomerang, OBJECT_IDX shuriken)
 
        if (shuriken) chance *= 2;
 
-       /* Save the old location */
        prev_y = y;
        prev_x = x;
 
@@ -2507,7 +2541,7 @@ bool do_cmd_throw(int mult, bool boomerang, OBJECT_IDX shuriken)
                if (!cave_have_flag_bold(ny[cur_dis], nx[cur_dis], FF_PROJECT))
                {
                        hit_wall = TRUE;
-                       if ((q_ptr->tval == TV_FIGURINE) || object_is_potion(q_ptr) || !cave[ny[cur_dis]][nx[cur_dis]].m_idx) break;
+                       if ((q_ptr->tval == TV_FIGURINE) || object_is_potion(q_ptr) || !current_floor_ptr->grid_array[ny[cur_dis]][nx[cur_dis]].m_idx) break;
                }
 
                /* The player can see the (on screen) missile */
@@ -2532,7 +2566,6 @@ bool do_cmd_throw(int mult, bool boomerang, OBJECT_IDX shuriken)
                        Term_xtra(TERM_XTRA_DELAY, msec);
                }
 
-               /* Save the old location */
                prev_y = y;
                prev_x = x;
 
@@ -2544,10 +2577,10 @@ bool do_cmd_throw(int mult, bool boomerang, OBJECT_IDX shuriken)
                cur_dis++;
 
                /* Monster here, Try to hit it */
-               if (cave[y][x].m_idx)
+               if (current_floor_ptr->grid_array[y][x].m_idx)
                {
-                       cave_type *c_ptr = &cave[y][x];
-                       monster_type *m_ptr = &m_list[c_ptr->m_idx];
+                       grid_type *g_ptr = &current_floor_ptr->grid_array[y][x];
+                       monster_type *m_ptr = &current_floor_ptr->m_list[g_ptr->m_idx];
 
                        /* Check the visibility */
                        visible = m_ptr->ml;
@@ -2577,7 +2610,7 @@ bool do_cmd_throw(int mult, bool boomerang, OBJECT_IDX shuriken)
                                        if (m_ptr->ml)
                                        {
                                                if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
-                                               health_track(c_ptr->m_idx);
+                                               health_track(g_ptr->m_idx);
                                        }
                                }
 
@@ -2623,7 +2656,7 @@ bool do_cmd_throw(int mult, bool boomerang, OBJECT_IDX shuriken)
                                        tdam, m_ptr->hp - tdam, m_ptr->maxhp, m_ptr->max_maxhp);
 
                                /* Hit the monster, check for death */
-                               if (mon_take_hit(c_ptr->m_idx, tdam, &fear, extract_note_dies(real_r_idx(m_ptr))))
+                               if (mon_take_hit(g_ptr->m_idx, tdam, &fear, extract_note_dies(real_r_idx(m_ptr))))
                                {
                                        /* Dead monster */
                                }
@@ -2631,7 +2664,7 @@ bool do_cmd_throw(int mult, bool boomerang, OBJECT_IDX shuriken)
                                /* No death */
                                else
                                {
-                                       message_pain(c_ptr->m_idx, tdam);
+                                       message_pain(g_ptr->m_idx, tdam);
 
                                        /* Anger the monster */
                                        if ((tdam > 0) && !object_is_potion(q_ptr))
@@ -2680,17 +2713,17 @@ bool do_cmd_throw(int mult, bool boomerang, OBJECT_IDX shuriken)
 
                        if (potion_smash_effect(0, y, x, q_ptr->k_idx))
                        {
-                               monster_type *m_ptr = &m_list[cave[y][x].m_idx];
+                               monster_type *m_ptr = &current_floor_ptr->m_list[current_floor_ptr->grid_array[y][x].m_idx];
 
                                /* ToDo (Robert): fix the invulnerability */
-                               if (cave[y][x].m_idx &&
-                                   is_friendly(&m_list[cave[y][x].m_idx]) &&
+                               if (current_floor_ptr->grid_array[y][x].m_idx &&
+                                   is_friendly(&current_floor_ptr->m_list[current_floor_ptr->grid_array[y][x].m_idx]) &&
                                    !MON_INVULNER(m_ptr))
                                {
                                        GAME_TEXT m_name[MAX_NLEN];
-                                       monster_desc(m_name, &m_list[cave[y][x].m_idx], 0);
+                                       monster_desc(m_name, &current_floor_ptr->m_list[current_floor_ptr->grid_array[y][x].m_idx], 0);
                                        msg_format(_("%sは怒った!", "%^s gets angry!"), m_name);
-                                       set_hostile(&m_list[cave[y][x].m_idx]);
+                                       set_hostile(&current_floor_ptr->m_list[current_floor_ptr->grid_array[y][x].m_idx]);
                                }
                        }
                        do_drop = FALSE;
@@ -2805,241 +2838,3 @@ bool do_cmd_throw(int mult, bool boomerang, OBJECT_IDX shuriken)
 
        return TRUE;
 }
-
-
-#ifdef TRAVEL
-/*
- * Hack: travel command
- */
-#define TRAVEL_UNABLE 9999
-
-static int flow_head = 0;
-static int flow_tail = 0;
-static POSITION temp2_x[MAX_SHORT];
-static POSITION temp2_y[MAX_SHORT];
-
-/*!
- * @brief トラベル処理の記憶配列を初期化する Hack: forget the "flow" information 
- * @return なし
- */
-void forget_travel_flow(void)
-{
-       POSITION x, y;
-       /* Check the entire dungeon / Forget the old data */
-       for (y = 0; y < cur_hgt; y++)
-       {
-               for (x = 0; x < cur_wid; x++)
-               {
-                       
-                       travel.cost[y][x] = MAX_SHORT;
-               }
-       }
-       travel.y = travel.x = 0;
-}
-
-/*!
- * @brief トラベル処理中に地形に応じた移動コスト基準を返す
- * @param y 該当地点のY座標
- * @param x 該当地点のX座標
- * @return コスト値
- */
-static int travel_flow_cost(POSITION y, POSITION x)
-{
-       feature_type *f_ptr = &f_info[cave[y][x].feat];
-       int cost = 1;
-
-       /* Avoid obstacles (ex. trees) */
-       if (have_flag(f_ptr->flags, FF_AVOID_RUN)) cost += 1;
-
-       /* Water */
-       if (have_flag(f_ptr->flags, FF_WATER))
-       {
-               if (have_flag(f_ptr->flags, FF_DEEP) && !p_ptr->levitation) cost += 5;
-       }
-
-       /* Lava */
-       if (have_flag(f_ptr->flags, FF_LAVA))
-       {
-               int lava = 2;
-               if (!p_ptr->resist_fire) lava *= 2;
-               if (!p_ptr->levitation) lava *= 2;
-               if (have_flag(f_ptr->flags, FF_DEEP)) lava *= 2;
-
-               cost += lava;
-       }
-
-       /* Detected traps and doors */
-       if (cave[y][x].info & (CAVE_MARK))
-       {
-               if (have_flag(f_ptr->flags, FF_DOOR)) cost += 1;
-               if (have_flag(f_ptr->flags, FF_TRAP)) cost += 10;
-       }
-
-       return (cost);
-}
-
-/*!
- * @brief トラベル処理の到達地点までの行程を得る処理のサブルーチン
- * @param y 目標地点のY座標
- * @param x 目標地点のX座標
- * @param n 現在のコスト
- * @param wall プレイヤーが壁の中にいるならばTRUE
- * @return なし
- */
-static void travel_flow_aux(POSITION y, POSITION x, int n, bool wall)
-{
-       cave_type *c_ptr = &cave[y][x];
-       feature_type *f_ptr = &f_info[c_ptr->feat];
-       int old_head = flow_head;
-       int add_cost = 1;
-       int base_cost = (n % TRAVEL_UNABLE);
-       int from_wall = (n / TRAVEL_UNABLE);
-       int cost;
-
-       /* Ignore out of bounds */
-       if (!in_bounds(y, x)) return;
-
-       /* Ignore unknown grid except in wilderness */
-       if (dun_level > 0 && !(c_ptr->info & CAVE_KNOWN)) return;
-
-       /* Ignore "walls" and "rubble" (include "secret doors") */
-       if (have_flag(f_ptr->flags, FF_WALL) ||
-               have_flag(f_ptr->flags, FF_CAN_DIG) ||
-               (have_flag(f_ptr->flags, FF_DOOR) && cave[y][x].mimic) ||
-               (!have_flag(f_ptr->flags, FF_MOVE) && have_flag(f_ptr->flags, FF_CAN_FLY) && !p_ptr->levitation))
-       {
-               if (!wall || !from_wall) return;
-               add_cost += TRAVEL_UNABLE;
-       }
-       else
-       {
-               add_cost = travel_flow_cost(y, x);
-       }
-
-       cost = base_cost + add_cost;
-
-       /* Ignore lower cost entries */
-       if (travel.cost[y][x] <= cost) return;
-
-       /* Save the flow cost */
-       travel.cost[y][x] = cost;
-
-       /* Enqueue that entry */
-       temp2_y[flow_head] = y;
-       temp2_x[flow_head] = x;
-
-       /* Advance the queue */
-       if (++flow_head == MAX_SHORT) flow_head = 0;
-
-       /* Hack -- notice overflow by forgetting new entry */
-       if (flow_head == flow_tail) flow_head = old_head;
-
-       return;
-}
-
-/*!
- * @brief トラベル処理の到達地点までの行程を得る処理のメインルーチン
- * @param ty 目標地点のY座標
- * @param tx 目標地点のX座標
- * @return なし
- */
-static void travel_flow(POSITION ty, POSITION tx)
-{
-       POSITION x, y, d;
-       bool wall = FALSE;
-       feature_type *f_ptr = &f_info[cave[p_ptr->y][p_ptr->x].feat];
-
-       /* Reset the "queue" */
-       flow_head = flow_tail = 0;
-
-       /* is player in the wall? */
-       if (!have_flag(f_ptr->flags, FF_MOVE)) wall = TRUE;
-
-       /* Start at the target grid */
-       travel_flow_aux(ty, tx, 0, wall);
-
-       /* Now process the queue */
-       while (flow_head != flow_tail)
-       {
-               /* Extract the next entry */
-               y = temp2_y[flow_tail];
-               x = temp2_x[flow_tail];
-
-               /* Forget that entry */
-               if (++flow_tail == MAX_SHORT) flow_tail = 0;
-
-               /* Ignore too far entries */
-               //if (distance(ty, tx, y, x) > 100) continue;
-
-               /* Add the "children" */
-               for (d = 0; d < 8; d++)
-               {
-                       /* Add that child if "legal" */
-                       travel_flow_aux(y + ddy_ddd[d], x + ddx_ddd[d], travel.cost[y][x], wall);
-               }
-       }
-
-       /* Forget the flow info */
-       flow_head = flow_tail = 0;
-}
-
-/*!
- * @brief トラベル処理のメインルーチン
- * @return なし
- */
-void do_cmd_travel(void)
-{
-       POSITION x, y;
-       int i;
-       POSITION dx, dy, sx, sy;
-       feature_type *f_ptr;
-
-       if (travel.x != 0 && travel.y != 0 &&
-           get_check(_("トラベルを継続しますか?", "Do you continue to travel?")))
-       {
-               y = travel.y;
-               x = travel.x;
-       }
-       else if (!tgt_pt(&x, &y)) return;
-
-       if ((x == p_ptr->x) && (y == p_ptr->y))
-       {
-               msg_print(_("すでにそこにいます!", "You are already there!!"));
-               return;
-       }
-
-       f_ptr = &f_info[cave[y][x].feat];
-
-       if ((cave[y][x].info & CAVE_MARK) &&
-               (have_flag(f_ptr->flags, FF_WALL) ||
-                       have_flag(f_ptr->flags, FF_CAN_DIG) ||
-                       (have_flag(f_ptr->flags, FF_DOOR) && cave[y][x].mimic)))
-       {
-               msg_print(_("そこには行くことができません!", "You cannot travel there!"));
-               return;
-       }
-
-       forget_travel_flow();
-       travel_flow(y, x);
-
-       travel.x = x;
-       travel.y = y;
-
-       /* Travel till 255 steps */
-       travel.run = 255;
-
-       /* Paranoia */
-       travel.dir = 0;
-
-       /* Decides first direction */
-       dx = abs(p_ptr->x - x);
-       dy = abs(p_ptr->y - y);
-       sx = ((x == p_ptr->x) || (dx < dy)) ? 0 : ((x > p_ptr->x) ? 1 : -1);
-       sy = ((y == p_ptr->y) || (dy < dx)) ? 0 : ((y > p_ptr->y) ? 1 : -1);
-
-       for (i = 1; i <= 9; i++)
-       {
-               if ((sx == ddx[i]) && (sy == ddy[i])) travel.dir = i;
-       }
-}
-#endif