OSDN Git Service

[Refactor] #38997 player_move.c 微修正 / Fixed a little in player_move.c
[hengband/hengband.git] / src / player-move.c
index 405ff92..1e3b095 100644 (file)
@@ -182,37 +182,39 @@ travel_type travel;
 /*!
  * @brief 地形やその上のアイテムの隠された要素を全て明かす /
  * Search for hidden things
+ * @param creature_ptr プレーヤーへの参照ポインタ
  * @param y 対象となるマスのY座標
  * @param x 対象となるマスのX座標
  * @return なし
  */
-static void discover_hidden_things(POSITION y, POSITION x)
+static void discover_hidden_things(player_type *creature_ptr, POSITION y, POSITION x)
 {
        OBJECT_IDX this_o_idx, next_o_idx = 0;
        grid_type *g_ptr;
-       g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x];
+       floor_type *floor_ptr = creature_ptr->current_floor_ptr;
+       g_ptr = &floor_ptr->grid_array[y][x];
 
        /* Invisible trap */
        if (g_ptr->mimic && is_trap(g_ptr->feat))
        {
-               disclose_grid(y, x);
+               disclose_grid(creature_ptr, y, x);
                msg_print(_("トラップを発見した。", "You have found a trap."));
-               disturb(p_ptr, FALSE, TRUE);
+               disturb(creature_ptr, FALSE, TRUE);
        }
 
        /* Secret door */
        if (is_hidden_door(g_ptr))
        {
                msg_print(_("隠しドアを発見した。", "You have found a secret door."));
-               disclose_grid(y, x);
-               disturb(p_ptr, FALSE, FALSE);
+               disclose_grid(creature_ptr, y, x);
+               disturb(creature_ptr, FALSE, FALSE);
        }
 
        /* Scan all objects in the grid */
        for (this_o_idx = g_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
        {
                object_type *o_ptr;
-               o_ptr = &p_ptr->current_floor_ptr->o_list[this_o_idx];
+               o_ptr = &floor_ptr->o_list[this_o_idx];
                next_o_idx = o_ptr->next_o_idx;
                if (o_ptr->tval != TV_CHEST) continue;
                if (!chest_traps[o_ptr->pval]) continue;
@@ -220,11 +222,12 @@ static void discover_hidden_things(POSITION y, POSITION x)
                {
                        msg_print(_("箱に仕掛けられたトラップを発見した!", "You have discovered a trap on the chest!"));
                        object_known(o_ptr);
-                       disturb(p_ptr, FALSE, FALSE);
+                       disturb(creature_ptr, FALSE, FALSE);
                }
        }
 }
 
+
 /*!
  * @brief プレイヤーの探索処理判定
  * @return なし
@@ -238,7 +241,7 @@ void search(player_type *creature_ptr)
        chance = creature_ptr->skill_srh;
 
        /* Penalize various conditions */
-       if (creature_ptr->blind || no_lite()) chance = chance / 10;
+       if (creature_ptr->blind || no_lite(creature_ptr)) chance = chance / 10;
        if (creature_ptr->confused || creature_ptr->image) chance = chance / 10;
 
        /* Search the nearby grids, which are always in bounds */
@@ -247,7 +250,7 @@ void search(player_type *creature_ptr)
                /* Sometimes, notice things */
                if (randint0(100) < chance)
                {
-                       discover_hidden_things(creature_ptr->y + ddy_ddd[i], creature_ptr->x + ddx_ddd[i]);
+                       discover_hidden_things(creature_ptr, creature_ptr->y + ddy_ddd[i], creature_ptr->x + ddx_ddd[i]);
                }
        }
 }
@@ -267,7 +270,7 @@ void search(player_type *creature_ptr)
  * Add the given dungeon object to the character's inventory.\n
  * Delete the object afterwards.\n
  */
-void py_pickup_aux(OBJECT_IDX o_idx)
+void py_pickup_aux(player_type *owner_ptr, OBJECT_IDX o_idx)
 {
        INVENTORY_IDX slot;
 
@@ -282,7 +285,7 @@ void py_pickup_aux(OBJECT_IDX o_idx)
 
        object_type *o_ptr;
 
-       o_ptr = &p_ptr->current_floor_ptr->o_list[o_idx];
+       o_ptr = &owner_ptr->current_floor_ptr->o_list[o_idx];
 
 #ifdef JP
        object_desc(old_name, o_ptr, OD_NAME_ONLY);
@@ -290,19 +293,19 @@ void py_pickup_aux(OBJECT_IDX o_idx)
        hirottakazu = o_ptr->number;
 #endif
        /* Carry the object */
-       slot = inven_carry(o_ptr);
+       slot = inven_carry(owner_ptr, o_ptr);
 
        /* Get the object again */
-       o_ptr = &p_ptr->inventory_list[slot];
+       o_ptr = &owner_ptr->inventory_list[slot];
 
-       delete_object_idx(o_idx);
+       delete_object_idx(owner_ptr->current_floor_ptr, o_idx);
 
-       if (p_ptr->pseikaku == SEIKAKU_MUNCHKIN)
+       if (owner_ptr->pseikaku == SEIKAKU_MUNCHKIN)
        {
-               bool old_known = identify_item(p_ptr, o_ptr);
+               bool old_known = identify_item(owner_ptr, o_ptr);
 
                /* Auto-inscription/destroy */
-               autopick_alter_item(slot, (bool)(destroy_identify && !old_known));
+               autopick_alter_item(owner_ptr, slot, (bool)(destroy_identify && !old_known));
 
                /* If it is destroyed, don't pick it up */
                if (o_ptr->marked & OM_AUTODESTROY) return;
@@ -311,11 +314,11 @@ void py_pickup_aux(OBJECT_IDX o_idx)
        object_desc(o_name, o_ptr, 0);
 
 #ifdef JP
-       if ((o_ptr->name1 == ART_CRIMSON) && (p_ptr->pseikaku == SEIKAKU_COMBAT))
+       if ((o_ptr->name1 == ART_CRIMSON) && (owner_ptr->pseikaku == SEIKAKU_COMBAT))
        {
-               msg_format("こうして、%sは『クリムゾン』を手に入れた。", p_ptr->name);
+               msg_format("こうして、%sは『クリムゾン』を手に入れた。", owner_ptr->name);
                msg_print("しかし今、『混沌のサーペント』の放ったモンスターが、");
-               msg_format("%sに襲いかかる...", p_ptr->name);
+               msg_format("%sに襲いかかる...", owner_ptr->name);
        }
        else
        {
@@ -341,7 +344,7 @@ void py_pickup_aux(OBJECT_IDX o_idx)
        record_turn = current_world_ptr->game_turn;
 
 
-       check_find_art_quest_completion(o_ptr);
+       check_find_art_quest_completion(owner_ptr, o_ptr);
 }
 
 
@@ -352,7 +355,7 @@ void py_pickup_aux(OBJECT_IDX o_idx)
  * @details
  * Player "wants" to pick up an object or gold.
  * Note that we ONLY handle things that can be picked up.
- * See "move_player(p_ptr, )" for handling of other things.
+ * See "move_player(creature_ptr, )" for handling of other things.
  */
 void carry(player_type *creature_ptr, bool pickup)
 {
@@ -368,10 +371,10 @@ void carry(player_type *creature_ptr, bool pickup)
        creature_ptr->update |= (PU_MONSTERS);
        creature_ptr->redraw |= (PR_MAP);
        creature_ptr->window |= (PW_OVERHEAD);
-       handle_stuff();
+       handle_stuff(creature_ptr);
 
        /* Automatically pickup/destroy/inscribe items */
-       autopick_pickup_items(g_ptr);
+       autopick_pickup_items(creature_ptr, g_ptr);
 
        if (easy_floor)
        {
@@ -407,7 +410,7 @@ void carry(player_type *creature_ptr, bool pickup)
                        int value = (long)o_ptr->pval;
 
                        /* Delete the gold */
-                       delete_object_idx(this_o_idx);
+                       delete_object_idx(creature_ptr->current_floor_ptr, this_o_idx);
 
                        msg_format(_(" $%ld の価値がある%sを見つけた。", "You collect %ld gold pieces worth of %s."),
                           (long)value, o_name);
@@ -459,7 +462,7 @@ void carry(player_type *creature_ptr, bool pickup)
                                if (okay)
                                {
                                        /* Pick up the object */
-                                       py_pickup_aux(this_o_idx);
+                                       py_pickup_aux(creature_ptr, this_o_idx);
                                }
                        }
                }
@@ -477,8 +480,8 @@ void carry(player_type *creature_ptr, bool pickup)
  */
 bool pattern_seq(player_type *creature_ptr, POSITION c_y, POSITION c_x, POSITION n_y, POSITION n_x)
 {
-       feature_type *cur_f_ptr = &f_info[p_ptr->current_floor_ptr->grid_array[c_y][c_x].feat];
-       feature_type *new_f_ptr = &f_info[p_ptr->current_floor_ptr->grid_array[n_y][n_x].feat];
+       feature_type *cur_f_ptr = &f_info[creature_ptr->current_floor_ptr->grid_array[c_y][c_x].feat];
+       feature_type *new_f_ptr = &f_info[creature_ptr->current_floor_ptr->grid_array[n_y][n_x].feat];
        bool is_pattern_tile_cur = have_flag(cur_f_ptr->flags, FF_PATTERN);
        bool is_pattern_tile_new = have_flag(new_f_ptr->flags, FF_PATTERN);
        int pattern_type_cur, pattern_type_new;
@@ -594,6 +597,7 @@ bool pattern_seq(player_type *creature_ptr, POSITION c_y, POSITION c_x, POSITION
        }
 }
 
+
 /*!
  * @brief 移動に伴うプレイヤーのステータス変化処理
  * @param ny 移動先Y座標
@@ -605,8 +609,9 @@ bool move_player_effect(player_type *creature_ptr, POSITION ny, POSITION nx, BIT
 {
        POSITION oy = creature_ptr->y;
        POSITION ox = creature_ptr->x;
-       grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[ny][nx];
-       grid_type *oc_ptr = &p_ptr->current_floor_ptr->grid_array[oy][ox];
+       floor_type *floor_ptr = creature_ptr->current_floor_ptr;
+       grid_type *g_ptr = &floor_ptr->grid_array[ny][nx];
+       grid_type *oc_ptr = &floor_ptr->grid_array[oy][ox];
        feature_type *f_ptr = &f_info[g_ptr->feat];
        feature_type *of_ptr = &f_info[oc_ptr->feat];
 
@@ -627,7 +632,7 @@ bool move_player_effect(player_type *creature_ptr, POSITION ny, POSITION nx, BIT
 
                        if (om_idx > 0) /* Monster on old spot (or creature_ptr->riding) */
                        {
-                               monster_type *om_ptr = &p_ptr->current_floor_ptr->m_list[om_idx];
+                               monster_type *om_ptr = &floor_ptr->m_list[om_idx];
                                om_ptr->fy = ny;
                                om_ptr->fx = nx;
                                update_monster(creature_ptr, om_idx, TRUE);
@@ -635,7 +640,7 @@ bool move_player_effect(player_type *creature_ptr, POSITION ny, POSITION nx, BIT
 
                        if (nm_idx > 0) /* Monster on new spot */
                        {
-                               monster_type *nm_ptr = &p_ptr->current_floor_ptr->m_list[nm_idx];
+                               monster_type *nm_ptr = &floor_ptr->m_list[nm_idx];
                                nm_ptr->fy = oy;
                                nm_ptr->fx = ox;
                                update_monster(creature_ptr, nm_idx, TRUE);
@@ -650,7 +655,7 @@ bool move_player_effect(player_type *creature_ptr, POSITION ny, POSITION nx, BIT
 
                if (mpe_mode & MPE_FORGET_FLOW)
                {
-                       forget_flow(creature_ptr->current_floor_ptr);
+                       forget_flow(floor_ptr);
 
                        creature_ptr->update |= (PU_UN_VIEW);
                        creature_ptr->redraw |= (PR_MAP);
@@ -660,11 +665,11 @@ bool move_player_effect(player_type *creature_ptr, POSITION ny, POSITION nx, BIT
                creature_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
 
                /* Remove "unsafe" flag */
-               if ((!creature_ptr->blind && !no_lite()) || !is_trap(g_ptr->feat)) g_ptr->info &= ~(CAVE_UNSAFE);
+               if ((!creature_ptr->blind && !no_lite(creature_ptr)) || !is_trap(g_ptr->feat)) g_ptr->info &= ~(CAVE_UNSAFE);
 
                /* For get everything when requested hehe I'm *NASTY* */
-               if (p_ptr->current_floor_ptr->dun_level && (d_info[creature_ptr->dungeon_idx].flags1 & DF1_FORGET)) wiz_dark(creature_ptr);
-               if (mpe_mode & MPE_HANDLE_STUFF) handle_stuff();
+               if (floor_ptr->dun_level && (d_info[creature_ptr->dungeon_idx].flags1 & DF1_FORGET)) wiz_dark(creature_ptr);
+               if (mpe_mode & MPE_HANDLE_STUFF) handle_stuff(creature_ptr);
 
                if (creature_ptr->pclass == CLASS_NINJA)
                {
@@ -721,7 +726,7 @@ bool move_player_effect(player_type *creature_ptr, POSITION ny, POSITION nx, BIT
        /* Handle "store doors" */
        if (have_flag(f_ptr->flags, FF_STORE))
        {
-               disturb(p_ptr, FALSE, TRUE);
+               disturb(creature_ptr, FALSE, TRUE);
 
                free_turn(creature_ptr);
                /* Hack -- Enter store */
@@ -731,7 +736,7 @@ bool move_player_effect(player_type *creature_ptr, POSITION ny, POSITION nx, BIT
        /* Handle "building doors" -KMW- */
        else if (have_flag(f_ptr->flags, FF_BLDG))
        {
-               disturb(p_ptr, FALSE, TRUE);
+               disturb(creature_ptr, FALSE, TRUE);
 
                free_turn(creature_ptr);
                /* Hack -- Enter building */
@@ -741,7 +746,7 @@ bool move_player_effect(player_type *creature_ptr, POSITION ny, POSITION nx, BIT
        /* Handle quest areas -KMW- */
        else if (have_flag(f_ptr->flags, FF_QUEST_ENTER))
        {
-               disturb(p_ptr, FALSE, TRUE);
+               disturb(creature_ptr, FALSE, TRUE);
 
                free_turn(creature_ptr);
                /* Hack -- Enter quest level */
@@ -750,15 +755,15 @@ bool move_player_effect(player_type *creature_ptr, POSITION ny, POSITION nx, BIT
 
        else if (have_flag(f_ptr->flags, FF_QUEST_EXIT))
        {
-               if (quest[creature_ptr->current_floor_ptr->inside_quest].type == QUEST_TYPE_FIND_EXIT)
+               if (quest[floor_ptr->inside_quest].type == QUEST_TYPE_FIND_EXIT)
                {
-                       complete_quest(creature_ptr->current_floor_ptr->inside_quest);
+                       complete_quest(creature_ptrfloor_ptr->inside_quest);
                }
 
-               leave_quest_check();
+               leave_quest_check(creature_ptr);
 
-               creature_ptr->current_floor_ptr->inside_quest = g_ptr->special;
-               p_ptr->current_floor_ptr->dun_level = 0;
+               floor_ptr->inside_quest = g_ptr->special;
+               floor_ptr->dun_level = 0;
                creature_ptr->oldpx = 0;
                creature_ptr->oldpy = 0;
 
@@ -768,7 +773,7 @@ bool move_player_effect(player_type *creature_ptr, POSITION ny, POSITION nx, BIT
        /* Set off a trap */
        else if (have_flag(f_ptr->flags, FF_HIT_TRAP) && !(mpe_mode & MPE_STAYING))
        {
-               disturb(p_ptr, FALSE, TRUE);
+               disturb(creature_ptr, FALSE, TRUE);
 
                /* Hidden trap */
                if (g_ptr->mimic || have_flag(f_ptr->flags, FF_SECRET))
@@ -776,7 +781,7 @@ bool move_player_effect(player_type *creature_ptr, POSITION ny, POSITION nx, BIT
                        msg_print(_("トラップだ!", "You found a trap!"));
 
                        /* Pick a trap */
-                       disclose_grid(creature_ptr->y, creature_ptr->x);
+                       disclose_grid(creature_ptr, creature_ptr->y, creature_ptr->x);
                }
 
                /* Hit the trap */
@@ -800,13 +805,14 @@ bool move_player_effect(player_type *creature_ptr, POSITION ny, POSITION nx, BIT
                                msg_print(_("* 注意:この先はトラップの感知範囲外です! *", "*Leaving trap detect region!*"));
                        }
 
-                       if (disturb_trap_detect) disturb(p_ptr, FALSE, TRUE);
+                       if (disturb_trap_detect) disturb(creature_ptr, FALSE, TRUE);
                }
        }
 
        return player_bold(creature_ptr, ny, nx) && !creature_ptr->is_dead && !creature_ptr->leaving;
 }
 
+
 /*!
  * @brief 該当地形のトラップがプレイヤーにとって無効かどうかを判定して返す
  * @param feat 地形ID
@@ -884,13 +890,14 @@ void move_player(player_type *creature_ptr, DIRECTION dir, bool do_pickup, bool
        POSITION x = creature_ptr->x + ddx[dir];
 
        /* Examine the destination */
-       grid_type *g_ptr = &creature_ptr->current_floor_ptr->grid_array[y][x];
+       floor_type *floor_ptr = creature_ptr->current_floor_ptr;
+       grid_type *g_ptr = &floor_ptr->grid_array[y][x];
 
        feature_type *f_ptr = &f_info[g_ptr->feat];
 
        monster_type *m_ptr;
 
-       monster_type *riding_m_ptr = &creature_ptr->current_floor_ptr->m_list[creature_ptr->riding];
+       monster_type *riding_m_ptr = &floor_ptr->m_list[creature_ptr->riding];
        monster_race *riding_r_ptr = &r_info[creature_ptr->riding ? riding_m_ptr->r_idx : 0];
 
        GAME_TEXT m_name[MAX_NLEN];
@@ -903,7 +910,7 @@ void move_player(player_type *creature_ptr, DIRECTION dir, bool do_pickup, bool
        bool do_past = FALSE;
 
        /* Exit the area */
-       if (!creature_ptr->current_floor_ptr->dun_level && !creature_ptr->wild_mode &&
+       if (!floor_ptr->dun_level && !creature_ptr->wild_mode &&
                ((x == 0) || (x == MAX_WID - 1) ||
                 (y == 0) || (y == MAX_HGT - 1)))
        {
@@ -915,8 +922,8 @@ void move_player(player_type *creature_ptr, DIRECTION dir, bool do_pickup, bool
                        {
                                creature_ptr->wilderness_y--;
                                creature_ptr->wilderness_x--;
-                               creature_ptr->oldpy = creature_ptr->current_floor_ptr->height - 2;
-                               creature_ptr->oldpx = creature_ptr->current_floor_ptr->width - 2;
+                               creature_ptr->oldpy = floor_ptr->height - 2;
+                               creature_ptr->oldpx = floor_ptr->width - 2;
                                creature_ptr->ambush_flag = FALSE;
                        }
 
@@ -924,7 +931,7 @@ void move_player(player_type *creature_ptr, DIRECTION dir, bool do_pickup, bool
                        {
                                creature_ptr->wilderness_y--;
                                creature_ptr->wilderness_x++;
-                               creature_ptr->oldpy = creature_ptr->current_floor_ptr->height - 2;
+                               creature_ptr->oldpy = floor_ptr->height - 2;
                                creature_ptr->oldpx = 1;
                                creature_ptr->ambush_flag = FALSE;
                        }
@@ -934,7 +941,7 @@ void move_player(player_type *creature_ptr, DIRECTION dir, bool do_pickup, bool
                                creature_ptr->wilderness_y++;
                                creature_ptr->wilderness_x--;
                                creature_ptr->oldpy = 1;
-                               creature_ptr->oldpx = creature_ptr->current_floor_ptr->width - 2;
+                               creature_ptr->oldpx = floor_ptr->width - 2;
                                creature_ptr->ambush_flag = FALSE;
                        }
 
@@ -950,7 +957,7 @@ void move_player(player_type *creature_ptr, DIRECTION dir, bool do_pickup, bool
                        else if (y == 0)
                        {
                                creature_ptr->wilderness_y--;
-                               creature_ptr->oldpy = creature_ptr->current_floor_ptr->height - 2;
+                               creature_ptr->oldpy = floor_ptr->height - 2;
                                creature_ptr->oldpx = x;
                                creature_ptr->ambush_flag = FALSE;
                        }
@@ -966,7 +973,7 @@ void move_player(player_type *creature_ptr, DIRECTION dir, bool do_pickup, bool
                        else if (x == 0)
                        {
                                creature_ptr->wilderness_x--;
-                               creature_ptr->oldpx = creature_ptr->current_floor_ptr->width - 2;
+                               creature_ptr->oldpx = floor_ptr->width - 2;
                                creature_ptr->oldpy = y;
                                creature_ptr->ambush_flag = FALSE;
                        }
@@ -990,7 +997,7 @@ void move_player(player_type *creature_ptr, DIRECTION dir, bool do_pickup, bool
                p_can_enter = FALSE;
        }
 
-       m_ptr = &creature_ptr->current_floor_ptr->m_list[g_ptr->m_idx];
+       m_ptr = &floor_ptr->m_list[g_ptr->m_idx];
 
        if (creature_ptr->inventory_list[INVEN_RARM].name1 == ART_STORMBRINGER) stormbringer = TRUE;
        if (creature_ptr->inventory_list[INVEN_LARM].name1 == ART_STORMBRINGER) stormbringer = TRUE;
@@ -1030,7 +1037,7 @@ void move_player(player_type *creature_ptr, DIRECTION dir, bool do_pickup, bool
                                py_attack(creature_ptr, y, x, 0);
                                oktomove = FALSE;
                        }
-                       else if (monster_can_cross_terrain(creature_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].feat, r_ptr, 0))
+                       else if (monster_can_cross_terrain(floor_ptr->grid_array[creature_ptr->y][creature_ptr->x].feat, r_ptr, 0))
                        {
                                do_past = TRUE;
                        }
@@ -1091,7 +1098,7 @@ void move_player(player_type *creature_ptr, DIRECTION dir, bool do_pickup, bool
                }
                else if (!have_flag(f_ptr->flags, FF_WATER) && (riding_r_ptr->flags7 & RF7_AQUATIC))
                {
-                       msg_format(_("%sから上がれない。", "Can't land."), f_name + f_info[get_feat_mimic(&creature_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x])].name);
+                       msg_format(_("%sから上がれない。", "Can't land."), f_name + f_info[get_feat_mimic(&floor_ptr->grid_array[creature_ptr->y][creature_ptr->x])].name);
                        free_turn(creature_ptr);
                        oktomove = FALSE;
                        disturb(creature_ptr, FALSE, TRUE);
@@ -1267,7 +1274,7 @@ void move_player(player_type *creature_ptr, DIRECTION dir, bool do_pickup, bool
 
                if (p_can_kill_walls)
                {
-                       cave_alter_feat(y, x, FF_HURT_DISI);
+                       cave_alter_feat(creature_ptr, y, x, FF_HURT_DISI);
 
                        /* Update some things -- similar to GF_KILL_WALL */
                        creature_ptr->update |= (PU_FLOW);
@@ -1302,7 +1309,7 @@ static bool see_wall(DIRECTION dir, POSITION y, POSITION x)
        x += ddx[dir];
 
        /* Illegal grids are not known walls */
-       if (!in_bounds2(p_ptr->current_floor_ptr, y, x)) return (FALSE);
+       if (!in_bounds2(p_ptr->current_floor_ptr, y, x)) return FALSE;
 
        /* Access grid */
        g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x];
@@ -1345,16 +1352,16 @@ static bool see_nothing(DIRECTION dir, POSITION y, POSITION x)
        x += ddx[dir];
 
        /* Illegal grids are unknown */
-       if (!in_bounds2(p_ptr->current_floor_ptr, y, x)) return (TRUE);
+       if (!in_bounds2(p_ptr->current_floor_ptr, y, x)) return TRUE;
 
        /* Memorized grids are always known */
-       if (p_ptr->current_floor_ptr->grid_array[y][x].info & (CAVE_MARK)) return (FALSE);
+       if (p_ptr->current_floor_ptr->grid_array[y][x].info & (CAVE_MARK)) return FALSE;
 
        /* Viewable door/wall grids are known */
-       if (player_can_see_bold(p_ptr, y, x)) return (FALSE);
+       if (player_can_see_bold(p_ptr, y, x)) return FALSE;
 
        /* Default */
-       return (TRUE);
+       return TRUE;
 }
 
 
@@ -1569,7 +1576,7 @@ static bool run_test(void)
                        monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[g_ptr->m_idx];
 
                        /* Visible monster */
-                       if (m_ptr->ml) return (TRUE);
+                       if (m_ptr->ml) return TRUE;
                }
 
                /* Visible objects abort running */
@@ -1580,7 +1587,7 @@ static bool run_test(void)
                        next_o_idx = o_ptr->next_o_idx;
 
                        /* Visible object */
-                       if (o_ptr->marked & OM_FOUND) return (TRUE);
+                       if (o_ptr->marked & OM_FOUND) return TRUE;
                }
 
                /* Assume unknown */
@@ -1624,7 +1631,7 @@ static bool run_test(void)
                        }
 
                        /* Interesting feature */
-                       if (notice) return (TRUE);
+                       if (notice) return TRUE;
 
                        /* The grid is "visible" */
                        inv = FALSE;
@@ -1648,13 +1655,13 @@ static bool run_test(void)
                        /* Three new directions. Stop running. */
                        else if (option2)
                        {
-                               return (TRUE);
+                               return TRUE;
                        }
 
                        /* Two non-adjacent new directions.  Stop running. */
                        else if (option != cycle[chome[prev_dir] + i - 1])
                        {
-                               return (TRUE);
+                               return TRUE;
                        }
 
                        /* Two new (adjacent) directions (case 1) */
@@ -1705,7 +1712,7 @@ static bool run_test(void)
                                /* Looking to break right */
                                if (find_breakright)
                                {
-                                       return (TRUE);
+                                       return TRUE;
                                }
                        }
 
@@ -1715,7 +1722,7 @@ static bool run_test(void)
                                /* Looking to break left */
                                if (find_breakleft)
                                {
-                                       return (TRUE);
+                                       return TRUE;
                                }
                        }
                }
@@ -1729,7 +1736,7 @@ static bool run_test(void)
                                /* Looking to break left */
                                if (find_breakleft)
                                {
-                                       return (TRUE);
+                                       return TRUE;
                                }
                        }
 
@@ -1739,7 +1746,7 @@ static bool run_test(void)
                                /* Looking to break right */
                                if (find_breakright)
                                {
-                                       return (TRUE);
+                                       return TRUE;
                                }
                        }
                }
@@ -1751,7 +1758,7 @@ static bool run_test(void)
                /* No options */
                if (!option)
                {
-                       return (TRUE);
+                       return TRUE;
                }
 
                /* One option */
@@ -1798,7 +1805,7 @@ static bool run_test(void)
                                /* STOP: we are next to an intersection or a room */
                                else
                                {
-                                       return (TRUE);
+                                       return TRUE;
                                }
                        }
 
@@ -1822,15 +1829,14 @@ static bool run_test(void)
        /* About to hit a known wall, stop */
        if (see_wall(find_current, p_ptr->y, p_ptr->x))
        {
-               return (TRUE);
+               return TRUE;
        }
 
        /* Failure */
-       return (FALSE);
+       return FALSE;
 }
 
 
-
 /*!
  * @brief 継続的なダッシュ処理 /
  * Take one step along the current "run" path
@@ -1906,7 +1912,7 @@ static DIRECTION travel_test(DIRECTION prev_dir)
        int cost;
 
        /* Cannot travel when blind */
-       if (p_ptr->blind || no_lite())
+       if (p_ptr->blind || no_lite(p_ptr))
        {
                msg_print(_("目が見えない!", "You cannot see!"));
                return (0);
@@ -1997,7 +2003,7 @@ static DIRECTION travel_test(DIRECTION prev_dir)
  * Travel command
  * @return なし
  */
-void travel_step(void)
+void travel_step(player_type *creature_ptr)
 {
        /* Get travel direction */
        travel.dir = travel_test(travel.dir);
@@ -2009,15 +2015,15 @@ void travel_step(void)
                        msg_print(_("道筋が見つかりません!", "No route is found!"));
                        travel.y = travel.x = 0;
                }
-               disturb(p_ptr, FALSE, TRUE);
+               disturb(creature_ptr, FALSE, TRUE);
                return;
        }
 
-       take_turn(p_ptr, 100);
+       take_turn(creature_ptr, 100);
 
-       move_player(p_ptr, travel.dir, always_pickup, FALSE);
+       move_player(creature_ptr, travel.dir, always_pickup, FALSE);
 
-       if ((p_ptr->y == travel.y) && (p_ptr->x == travel.x))
+       if ((creature_ptr->y == travel.y) && (creature_ptr->x == travel.x))
        {
                travel.run = 0;
                travel.y = travel.x = 0;
@@ -2042,17 +2048,18 @@ 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)
+void forget_travel_flow(floor_type *floor_ptr)
 {
        POSITION x, y;
        /* Check the entire dungeon / Forget the old data */
-       for (y = 0; y < p_ptr->current_floor_ptr->height; y++)
+       for (y = 0; y < floor_ptr->height; y++)
        {
-               for (x = 0; x < p_ptr->current_floor_ptr->width; x++)
+               for (x = 0; x < floor_ptr->width; x++)
                {
 
                        travel.cost[y][x] = MAX_SHORT;
@@ -2061,15 +2068,16 @@ void forget_travel_flow(void)
        travel.y = travel.x = 0;
 }
 
+
 /*!
  * @brief トラベル処理中に地形に応じた移動コスト基準を返す
  * @param y 該当地点のY座標
  * @param x 該当地点のX座標
  * @return コスト値
  */
-static int travel_flow_cost(POSITION y, POSITION x)
+static int travel_flow_cost(player_type *creature_ptr, POSITION y, POSITION x)
 {
-       feature_type *f_ptr = &f_info[p_ptr->current_floor_ptr->grid_array[y][x].feat];
+       feature_type *f_ptr = &f_info[creature_ptr->current_floor_ptr->grid_array[y][x].feat];
        int cost = 1;
 
        /* Avoid obstacles (ex. trees) */
@@ -2078,30 +2086,31 @@ static int travel_flow_cost(POSITION y, POSITION x)
        /* Water */
        if (have_flag(f_ptr->flags, FF_WATER))
        {
-               if (have_flag(f_ptr->flags, FF_DEEP) && !p_ptr->levitation) cost += 5;
+               if (have_flag(f_ptr->flags, FF_DEEP) && !creature_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 (!creature_ptr->resist_fire) lava *= 2;
+               if (!creature_ptr->levitation) lava *= 2;
                if (have_flag(f_ptr->flags, FF_DEEP)) lava *= 2;
 
                cost += lava;
        }
 
        /* Detected traps and doors */
-       if (p_ptr->current_floor_ptr->grid_array[y][x].info & (CAVE_MARK))
+       if (creature_ptr->current_floor_ptr->grid_array[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);
+       return cost;
 }
 
+
 /*!
  * @brief トラベル処理の到達地点までの行程を得る処理のサブルーチン
  * @param y 目標地点のY座標
@@ -2137,7 +2146,7 @@ static void travel_flow_aux(POSITION y, POSITION x, int n, bool wall)
        }
        else
        {
-               add_cost = travel_flow_cost(y, x);
+               add_cost = travel_flow_cost(p_ptr, y, x);
        }
 
        cost = base_cost + add_cost;
@@ -2157,10 +2166,9 @@ static void travel_flow_aux(POSITION y, POSITION x, int n, bool wall)
 
        /* Hack -- notice overflow by forgetting new entry */
        if (flow_head == flow_tail) flow_head = old_head;
-
-       return;
 }
 
+
 /*!
  * @brief トラベル処理の到達地点までの行程を得る処理のメインルーチン
  * @param ty 目標地点のY座標
@@ -2208,6 +2216,7 @@ static void travel_flow(POSITION ty, POSITION tx)
        flow_head = flow_tail = 0;
 }
 
+
 /*!
  * @brief トラベル処理のメインルーチン
  * @return なし
@@ -2225,7 +2234,7 @@ void do_cmd_travel(player_type *creature_ptr)
                y = travel.y;
                x = travel.x;
        }
-       else if (!tgt_pt(&x, &y)) return;
+       else if (!tgt_pt(creature_ptr, &x, &y)) return;
 
        if ((x == creature_ptr->x) && (y == creature_ptr->y))
        {
@@ -2244,7 +2253,7 @@ void do_cmd_travel(player_type *creature_ptr)
                return;
        }
 
-       forget_travel_flow();
+       forget_travel_flow(creature_ptr->current_floor_ptr);
        travel_flow(y, x);
 
        travel.x = x;
@@ -2267,6 +2276,7 @@ void do_cmd_travel(player_type *creature_ptr)
 }
 #endif
 
+
 /*
  * Something has happened to disturb the player.
  * The first arg indicates a major disturbance, which affects search.