OSDN Git Service

[Refactor] monster_name() で一部 cmd2.c の投擲対象処理を整理。
[hengband/hengband.git] / src / cmd2.c
index b8a2597..6ff147f 100644 (file)
@@ -12,6 +12,7 @@
 
 #include "angband.h"
 #include "chest.h"
+#include "trap.h"
 #include "floor.h"
 #include "melee.h"
 #include "object-hook.h"
 #include "avatar.h"
 #include "player-status.h"
 #include "realm-hex.h"
+#include "geometry.h"
+#include "wild.h"
+#include "grid.h"
+#include "feature.h"
+#include "player-move.h"
+#include "object-broken.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];
 
@@ -53,10 +60,35 @@ bool confirm_leave_level(bool down_stair)
        return FALSE;
 }
 
+/*!
+ * @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 (p_ptr->confused)
+       if (creature_ptr->confused)
        {
                msg_print(_("混乱していてできない!", "You are too confused!"));
                return TRUE;
@@ -64,9 +96,29 @@ bool cmd_limit_confused(player_type *creature_ptr)
        return FALSE;
 }
 
+bool cmd_limit_image(player_type *creature_ptr)
+{
+       if (creature_ptr->image)
+       {
+               msg_print(_("幻覚が見えて集中できない!", "You are too hallucinated!"));
+               return TRUE;
+       }
+       return FALSE;
+}
+
+bool cmd_limit_stun(player_type *creature_ptr)
+{
+       if (creature_ptr->stun)
+       {
+               msg_print(_("頭が朦朧としていて集中できない!", "You are too stuned!"));
+               return TRUE;
+       }
+       return FALSE;
+}
+
 bool cmd_limit_arena(player_type *creature_ptr)
 {
-       if (p_ptr->inside_arena)
+       if (creature_ptr->inside_arena)
        {
                msg_print(_("アリーナが魔法を吸収した!", "The arena absorbs all attempted magic!"));
                msg_print(NULL);
@@ -75,9 +127,24 @@ bool cmd_limit_arena(player_type *creature_ptr)
        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 (world_player)
+       if (creature_ptr->timewalk)
        {
                if (flush_failure) flush();
                msg_print(_("止まった時の中ではうまく働かないようだ。", "It shows no reaction."));
@@ -96,8 +163,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;
 
@@ -128,7 +195,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)
@@ -144,23 +211,20 @@ void do_cmd_go_up(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);
 
                /* End the command */
                return;
        }
 
-       if (!dun_level)
+       if (!current_floor_ptr->dun_level)
        {
                go_up = TRUE;
        }
@@ -172,8 +236,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);
 
@@ -192,8 +255,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;
        }
 
@@ -217,20 +280,18 @@ 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."));
-
-       /* Leaving */
        p_ptr->leaving = TRUE;
 }
 
@@ -242,8 +303,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;
@@ -282,7 +343,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)
@@ -298,27 +359,22 @@ 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))
                        {
@@ -335,7 +391,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
@@ -344,8 +400,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);
 
@@ -353,11 +408,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)
@@ -375,7 +430,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
                        {
@@ -386,8 +441,6 @@ void do_cmd_go_down(void)
                        }
                }
 
-
-               /* Leaving */
                p_ptr->leaving = TRUE;
 
                if (fall_trap)
@@ -412,7 +465,7 @@ void do_cmd_go_down(void)
 
 
 /*!
- * @brief 探索コマンドのメインルーチン / Simple command to "search" for one turn
+ * @brief 探索コマンドのメインルーチン / Simple command to "search" for one current_world_ptr->game_turn
  * @return なし
  */
 void do_cmd_search(void)
@@ -427,7 +480,7 @@ void do_cmd_search(void)
                /* Cancel the arg */
                command_arg = 0;
        }
-       p_ptr->energy_use = 100;
+       take_turn(p_ptr, 100);
 
        /* Search */
        search();
@@ -443,15 +496,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 */
@@ -483,9 +536,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)
@@ -550,7 +603,9 @@ static bool do_cmd_open_chest(POSITION y, POSITION x, OBJECT_IDX o_idx)
  */
 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;
@@ -558,7 +613,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 */
@@ -568,14 +623,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;
@@ -605,9 +660,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 */
@@ -624,7 +679,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;
@@ -646,26 +701,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 「開ける」動作コマンドのサブルーチン /
@@ -683,11 +718,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) */
 
@@ -695,7 +730,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 */
@@ -812,17 +847,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);
@@ -834,9 +869,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);
                }
@@ -875,11 +910,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) */
 
@@ -889,7 +924,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."));
@@ -900,7 +935,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."));
                        }
@@ -959,15 +994,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))
@@ -976,9 +1011,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!"));
 
@@ -1008,10 +1043,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."));
 
@@ -1019,7 +1054,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."));
 
@@ -1043,7 +1078,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;
@@ -1052,15 +1087,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;
 
@@ -1091,8 +1125,6 @@ static bool do_cmd_tunnel_aux(POSITION y, POSITION x)
 
                        /* Remove the feature */
                        cave_alter_feat(y, x, FF_TUNNEL);
-
-                       /* Update some things */
                        p_ptr->update |= (PU_FLOW);
                }
                else
@@ -1147,7 +1179,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();
@@ -1163,7 +1195,7 @@ static bool do_cmd_tunnel_aux(POSITION y, POSITION x)
  * @details
  * <pre>
  * Note that you must tunnel in order to hit invisible monsters
- * in walls, though moving into walls still takes a turn anyway.
+ * in walls, though moving into walls still takes a current_world_ptr->game_turn anyway.
  *
  * Digging is very difficult without a "digger" weapon, but can be
  * accomplished by strong players using heavy weapons.
@@ -1171,13 +1203,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)
        {
@@ -1202,11 +1233,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))
@@ -1221,9 +1251,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!"));
 
@@ -1261,11 +1291,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);
        }
@@ -1274,7 +1304,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);
 
        }
 
@@ -1351,9 +1381,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;
@@ -1432,10 +1462,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);
@@ -1448,7 +1478,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;
@@ -1552,15 +1582,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);
@@ -1572,7 +1602,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!"));
 
@@ -1614,11 +1644,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) */
@@ -1629,9 +1658,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);
 
@@ -1651,7 +1680,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);
                }
@@ -1709,7 +1738,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;
@@ -1739,11 +1768,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))
@@ -1752,9 +1780,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!"));
 
@@ -1786,7 +1814,7 @@ void do_cmd_bash(void)
  *
  * Consider confusion 
  *
- * This command must always take a turn, to prevent free detection
+ * This command must always take a current_world_ptr->game_turn, to prevent free detection
  * of invisible monsters.
  * </pre>
  */
@@ -1794,7 +1822,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)
@@ -1822,16 +1850,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);
                }
@@ -1940,15 +1967,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))
@@ -1963,9 +1990,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!"));
 
@@ -1976,7 +2003,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);
@@ -2019,7 +2046,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))
                {
@@ -2054,7 +2081,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;
@@ -2115,7 +2142,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);
@@ -2134,7 +2161,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 */
@@ -2175,14 +2202,12 @@ void do_cmd_rest(void)
                }
        }
 
-
-       /* Paranoia */
        if (command_arg > 9999) command_arg = 9999;
 
        if (p_ptr->special_defense & NINJA_S_STEALTH) set_superstealth(FALSE);
 
-       /* Take a turn (?) */
-       p_ptr->energy_use = 100;
+       /* Take a current_world_ptr->game_turn (?) */
+       take_turn(p_ptr, 100);
 
        /* The sin of sloth */
        if (command_arg > 100) chg_virtue(V_DILIGENCE, -1);
@@ -2199,7 +2224,7 @@ void do_cmd_rest(void)
                        chg_virtue(V_DILIGENCE, -1);
 
        /* Save the rest code */
-       resting = command_arg;
+       p_ptr->resting = command_arg;
        p_ptr->action = ACTION_REST;
        p_ptr->update |= (PU_BONUS);
        update_creature(p_ptr);
@@ -2216,7 +2241,7 @@ void do_cmd_rest(void)
  * @brief 射撃処理のメインルーチン
  * @return なし
  */
-void do_cmd_fire(void)
+void do_cmd_fire(SPELL_IDX snipe_type)
 {
        OBJECT_IDX item;
        object_type *j_ptr, *ammo_ptr;
@@ -2272,7 +2297,7 @@ void do_cmd_fire(void)
        }
 
        /* Fire the item */
-       exe_fire(item, j_ptr);
+       exe_fire(item, j_ptr, snipe_type);
 
        if (!is_fired || p_ptr->pclass != CLASS_SNIPER) return;
 
@@ -2389,7 +2414,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;
        }
 
@@ -2488,7 +2512,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))
@@ -2528,7 +2552,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 */
@@ -2564,10 +2588,12 @@ 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];
+                       GAME_TEXT m_name[MAX_NLEN];
+                       monster_name(g_ptr->m_idx, m_name);
 
                        /* Check the visibility */
                        visible = m_ptr->ml;
@@ -2590,14 +2616,12 @@ bool do_cmd_throw(int mult, bool boomerang, OBJECT_IDX shuriken)
                                /* Handle visible monster */
                                else
                                {
-                                       GAME_TEXT m_name[MAX_NLEN];
-                                       monster_desc(m_name, m_ptr, 0);
                                        msg_format(_("%sが%sに命中した。", "The %s hits %s."), o_name, m_name);
 
                                        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);
                                        }
                                }
 
@@ -2643,7 +2667,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 */
                                }
@@ -2651,7 +2675,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))
@@ -2660,8 +2684,6 @@ bool do_cmd_throw(int mult, bool boomerang, OBJECT_IDX shuriken)
                                        if (fear && m_ptr->ml)
                                        {
                                                sound(SOUND_FLEE);
-                                               GAME_TEXT m_name[MAX_NLEN];
-                                               monster_desc(m_name, m_ptr, 0);
                                                msg_format(_("%^sは恐怖して逃げ出した!", "%^s flees in terror!"), m_name);
                                        }
                                }
@@ -2676,7 +2698,7 @@ bool do_cmd_throw(int mult, bool boomerang, OBJECT_IDX shuriken)
        if (hit_body) torch_lost_fuel(q_ptr);
 
        /* Chance of breakage (during attacks) */
-       j = (hit_body ? breakage_chance(q_ptr) : 0);
+       j = (hit_body ? breakage_chance(q_ptr, 0) : 0);
 
        /* Figurines transform */
        if ((q_ptr->tval == TV_FIGURINE) && !(p_ptr->inside_arena))
@@ -2690,7 +2712,6 @@ bool do_cmd_throw(int mult, bool boomerang, OBJECT_IDX shuriken)
 
        }
 
-
        /* Potions smash open */
        if (object_is_potion(q_ptr))
        {
@@ -2700,17 +2721,13 @@ 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];
-
-                               /* ToDo (Robert): fix the invulnerability */
-                               if (cave[y][x].m_idx &&
-                                   is_friendly(&m_list[cave[y][x].m_idx]) &&
-                                   !MON_INVULNER(m_ptr))
+                               monster_type *m_ptr = &current_floor_ptr->m_list[current_floor_ptr->grid_array[y][x].m_idx];
+                               if (current_floor_ptr->grid_array[y][x].m_idx && is_friendly(m_ptr) && !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, m_ptr, 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;
@@ -2795,7 +2812,6 @@ bool do_cmd_throw(int mult, bool boomerang, OBJECT_IDX shuriken)
                        /* Increment the equip counter by hand */
                        equip_cnt++;
 
-                       /* Recalculate torch */
                        p_ptr->update |= (PU_BONUS | PU_TORCH | PU_MANA);
                        p_ptr->window |= (PW_EQUIP);
                }
@@ -2826,240 +2842,82 @@ 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 
+ * @brief 自殺するコマンドのメインルーチン
+ * Hack -- commit suicide
  * @return なし
+ * @details
  */
-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)
+void do_cmd_suicide(void)
 {
-       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;
+       int i;
 
-               cost += lava;
-       }
+       /* Flush input */
+       flush();
 
-       /* Detected traps and doors */
-       if (cave[y][x].info & (CAVE_MARK))
+       /* Verify Retirement */
+       if (p_ptr->total_winner)
        {
-               if (have_flag(f_ptr->flags, FF_DOOR)) cost += 1;
-               if (have_flag(f_ptr->flags, FF_TRAP)) cost += 10;
+               /* Verify */
+               if (!get_check_strict(_("引退しますか? ", "Do you want to retire? "), CHECK_NO_HISTORY)) return;
        }
 
-       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;
-       }
+       /* Verify Suicide */
        else
        {
-               add_cost = travel_flow_cost(y, x);
+               /* Verify */
+               if (!get_check(_("本当に自殺しますか?", "Do you really want to commit suicide? "))) return;
        }
 
-       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];
+       if (!p_ptr->noscore)
+       {
+               /* Special Verification for suicide */
+               prt(_("確認のため '@' を押して下さい。", "Please verify SUICIDE by typing the '@' sign: "), 0, 0);
 
-       /* Reset the "queue" */
-       flow_head = flow_tail = 0;
+               flush();
+               i = inkey();
+               prt("", 0, 0);
+               if (i != '@') return;
 
-       /* is player in the wall? */
-       if (!have_flag(f_ptr->flags, FF_MOVE)) wall = TRUE;
+               play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_GAMEOVER);
+       }
 
-       /* Start at the target grid */
-       travel_flow_aux(ty, tx, 0, wall);
+       /* Initialize "last message" buffer */
+       if (p_ptr->last_message) string_free(p_ptr->last_message);
+       p_ptr->last_message = NULL;
 
-       /* Now process the queue */
-       while (flow_head != flow_tail)
+       /* Hack -- Note *winning* message */
+       if (p_ptr->total_winner && last_words)
        {
-               /* 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;
+               char buf[1024] = "";
+               play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_WINNER);
+               do
+               {
+                       while (!get_string(_("*勝利*メッセージ: ", "*Winning* message: "), buf, sizeof buf));
+               } while (!get_check_strict(_("よろしいですか?", "Are you sure? "), CHECK_NO_HISTORY));
 
-               /* Add the "children" */
-               for (d = 0; d < 8; d++)
+               if (buf[0])
                {
-                       /* Add that child if "legal" */
-                       travel_flow_aux(y + ddy_ddd[d], x + ddx_ddd[d], travel.cost[y][x], wall);
+                       p_ptr->last_message = string_make(buf);
+                       msg_print(p_ptr->last_message);
                }
        }
 
-       /* Forget the flow info */
-       flow_head = flow_tail = 0;
-}
+       /* Stop playing */
+       p_ptr->playing = FALSE;
 
-/*!
- * @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;
+       /* Kill the player */
+       p_ptr->is_dead = TRUE;
+       p_ptr->leaving = TRUE;
 
-       if ((x == p_ptr->x) && (y == p_ptr->y))
+       if (!p_ptr->total_winner)
        {
-               msg_print(_("すでにそこにいます!", "You are already there!!"));
-               return;
+               do_cmd_write_nikki(NIKKI_BUNSHOU, 0, _("ダンジョンの探索に絶望して自殺した。", "give up all hope to commit suicide."));
+               do_cmd_write_nikki(NIKKI_GAMESTART, 1, _("-------- ゲームオーバー --------", "--------   Game  Over   --------"));
+               do_cmd_write_nikki(NIKKI_BUNSHOU, 1, "\n\n\n\n");
        }
 
-       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;
-       }
+       /* Cause of death */
+       (void)strcpy(p_ptr->died_from, _("途中終了", "Quitting"));
 }
-#endif