OSDN Git Service

[Refactor] #38997 pattern_seq() に player_type * 引数を追加.
authordeskull <deskull@users.sourceforge.jp>
Thu, 18 Jul 2019 02:46:44 +0000 (11:46 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Thu, 18 Jul 2019 02:46:44 +0000 (11:46 +0900)
src/cmd-basic.c
src/cmd-pet.c
src/mind.c
src/monster-process.c
src/player-move.c
src/player-move.h
src/realm-hissatsu.c
src/spells-floor.c
src/spells2.c
src/spells3.c

index 7dfe680..4a7cdf5 100644 (file)
@@ -2146,7 +2146,7 @@ void do_cmd_stay(bool pickup)
        take_turn(p_ptr, 100);
 
        if (pickup) mpe_mode |= MPE_DO_PICKUP;
-       (void)move_player_effect(p_ptr->y, p_ptr->x, mpe_mode);
+       (void)move_player_effect(p_ptr, p_ptr->y, p_ptr->x, mpe_mode);
 }
 
 
index 918efb9..fce80c8 100644 (file)
@@ -296,7 +296,7 @@ bool do_riding(bool force)
                        return FALSE;
                }
 
-               if (!pattern_seq(p_ptr->y, p_ptr->x, y, x)) return FALSE;
+               if (!pattern_seq(p_ptr, p_ptr->y, p_ptr->x, y, x)) return FALSE;
 
                if (g_ptr->m_idx)
                {
@@ -334,7 +334,7 @@ bool do_riding(bool force)
                        return FALSE;
                }
 
-               if (!pattern_seq(p_ptr->y, p_ptr->x, y, x)) return FALSE;
+               if (!pattern_seq(p_ptr, p_ptr->y, p_ptr->x, y, x)) return FALSE;
 
                if (!player_can_ride_aux(g_ptr, TRUE))
                {
@@ -385,7 +385,7 @@ bool do_riding(bool force)
        p_ptr->redraw |= (PR_MAP | PR_EXTRA);
        p_ptr->redraw |= (PR_UHEALTH);
 
-       (void)move_player_effect(y, x, MPE_HANDLE_STUFF | MPE_ENERGY_USE | MPE_DONT_PICKUP | MPE_DONT_SWAP_MON);
+       (void)move_player_effect(p_ptr, y, x, MPE_HANDLE_STUFF | MPE_ENERGY_USE | MPE_DONT_PICKUP | MPE_DONT_SWAP_MON);
 
        return TRUE;
 }
@@ -1100,7 +1100,7 @@ bool rakuba(HIT_POINT dam, bool force)
        }
 
        if (sy && !p_ptr->is_dead)
-               (void)move_player_effect(p_ptr->y, p_ptr->x, MPE_DONT_PICKUP | MPE_DONT_SWAP_MON);
+               (void)move_player_effect(p_ptr, p_ptr->y, p_ptr->x, MPE_DONT_PICKUP | MPE_DONT_SWAP_MON);
 
        return fall_dam;
 }
index 5608351..4ce806f 100644 (file)
@@ -1507,7 +1507,7 @@ static bool cast_berserk_spell(int spell)
                if (player_can_enter(current_floor_ptr->grid_array[y][x].feat, 0) && !is_trap(current_floor_ptr->grid_array[y][x].feat) && !current_floor_ptr->grid_array[y][x].m_idx)
                {
                        msg_print(NULL);
-                       (void)move_player_effect(y, x, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP);
+                       (void)move_player_effect(p_ptr, y, x, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP);
                }
                break;
        }
index d00ac49..8239759 100644 (file)
@@ -2204,7 +2204,7 @@ void process_monster(MONSTER_IDX m_idx)
                        else
                        {
                                /* sound(SOUND_WALK); */
-                               if (!move_player_effect(ny, nx, MPE_DONT_PICKUP)) break;
+                               if (!move_player_effect(p_ptr, ny, nx, MPE_DONT_PICKUP)) break;
                        }
 
                        /* Possible disturb */
index e426987..4932bc3 100644 (file)
@@ -475,7 +475,7 @@ void carry(bool pickup)
  * @param n_x プレイヤーの移動先X座標
  * @return 移動処理が可能である場合(可能な場合に選択した場合)TRUEを返す。
  */
-bool pattern_seq(POSITION c_y, POSITION c_x, POSITION n_y, POSITION n_x)
+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[current_floor_ptr->grid_array[c_y][c_x].feat];
        feature_type *new_f_ptr = &f_info[current_floor_ptr->grid_array[n_y][n_x].feat];
@@ -490,7 +490,7 @@ bool pattern_seq(POSITION c_y, POSITION c_x, POSITION n_y, POSITION n_x)
 
        if (pattern_type_new == PATTERN_TILE_START)
        {
-               if (!is_pattern_tile_cur && !p_ptr->confused && !p_ptr->stun && !p_ptr->image)
+               if (!is_pattern_tile_cur && !creature_ptr->confused && !creature_ptr->stun && !creature_ptr->image)
                {
                        if (get_check(_("パターンの上を歩き始めると、全てを歩かなければなりません。いいですか?", 
                                                        "If you start walking the Pattern, you must walk the whole way. Ok? ")))
@@ -573,7 +573,7 @@ bool pattern_seq(POSITION c_y, POSITION c_x, POSITION n_y, POSITION n_x)
                                        ok_move = PATTERN_TILE_1;
                                        break;
                                default:
-                                       if (p_ptr->wizard)
+                                       if (creature_ptr->wizard)
                                                msg_format(_("おかしなパターン歩行、%d。", "Funny Pattern walking, %d."), pattern_type_cur);
 
                                        return TRUE; /* Goof-up */
@@ -1010,7 +1010,7 @@ void move_player(player_type *creature_ptr, DIRECTION dir, bool do_pickup, bool
                if (!is_hostile(m_ptr) &&
                    !(creature_ptr->confused || creature_ptr->image || !m_ptr->ml || creature_ptr->stun ||
                    ((creature_ptr->muta2 & MUT2_BERS_RAGE) && creature_ptr->shero)) &&
-                   pattern_seq(creature_ptr->y, creature_ptr->x, y, x) && (p_can_enter || p_can_kill_walls))
+                   pattern_seq(p_ptr, creature_ptr->y, creature_ptr->x, y, x) && (p_can_enter || p_can_kill_walls))
                {
                        /* Disturb the monster */
                        (void)set_monster_csleep(g_ptr->m_idx, 0);
@@ -1222,7 +1222,7 @@ void move_player(player_type *creature_ptr, DIRECTION dir, bool do_pickup, bool
        }
 
        /* Normal movement */
-       if (oktomove && !pattern_seq(creature_ptr->y, creature_ptr->x, y, x))
+       if (oktomove && !pattern_seq(p_ptr, creature_ptr->y, creature_ptr->x, y, x))
        {
                if (!(creature_ptr->confused || creature_ptr->stun || creature_ptr->image))
                {
index 7819c21..f59b617 100644 (file)
@@ -21,7 +21,7 @@ extern void run_step(DIRECTION dir);
 extern bool move_player_effect(player_type *creature_ptr, POSITION ny, POSITION nx, BIT_FLAGS mpe_mode);
 
 extern void py_pickup_aux(OBJECT_IDX o_idx);
-extern bool pattern_seq(POSITION c_y, POSITION c_x, POSITION n_y, POSITION n_x);
+extern bool pattern_seq(player_type *creature_ptr, POSITION c_y, POSITION c_x, POSITION n_y, POSITION n_x);
 extern bool trap_can_be_ignored(player_type *creature_ptr, FEAT_IDX feat);
 extern void search(player_type *creature_ptr);
 extern void carry(bool pickup);
index b706fdf..1a43f98 100644 (file)
@@ -217,7 +217,7 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
                        if (player_can_enter(current_floor_ptr->grid_array[y][x].feat, 0) && !is_trap(current_floor_ptr->grid_array[y][x].feat) && !current_floor_ptr->grid_array[y][x].m_idx)
                        {
                                msg_print(NULL);
-                               (void)move_player_effect(y, x, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP);
+                               (void)move_player_effect(p_ptr, y, x, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP);
                        }
                }
                break;
@@ -699,7 +699,7 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
                                /* Player can move forward? */
                                if (player_can_enter(g_ptr->feat, 0))
                                {
-                                       if (!move_player_effect(y, x, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP)) break;
+                                       if (!move_player_effect(p_ptr, y, x, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP)) break;
                                }
                                else
                                {
index c028645..54d4528 100644 (file)
@@ -888,7 +888,7 @@ bool earthquake(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx)
                        }
 
                        /* Move the player to the safe location */
-                       (void)move_player_effect(sy, sx, MPE_DONT_PICKUP);
+                       (void)move_player_effect(p_ptr, sy, sx, MPE_DONT_PICKUP);
                }
 
                /* Important -- no wall on player */
index 78e38d8..6fcf127 100644 (file)
@@ -2186,7 +2186,7 @@ bool teleport_swap(DIRECTION dir)
        sound(SOUND_TELEPORT);
 
        /* Swap the player and monster */
-       (void)move_player_effect(ty, tx, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP);
+       (void)move_player_effect(p_ptr, ty, tx, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP);
 
        /* Success */
        return TRUE;
index 7f44049..aebc817 100644 (file)
@@ -390,7 +390,7 @@ bool teleport_player_aux(POSITION dis, BIT_FLAGS mode)
                msg_format("『こっちだぁ、%s』", p_ptr->name);
 #endif
 
-       (void)move_player_effect(y, x, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP);
+       (void)move_player_effect(p_ptr, y, x, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP);
        return TRUE;
 }
 
@@ -528,7 +528,7 @@ void teleport_player_to(POSITION ny, POSITION nx, BIT_FLAGS mode)
        }
 
        sound(SOUND_TELEPORT);
-       (void)move_player_effect(y, x, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP);
+       (void)move_player_effect(p_ptr, y, x, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP);
 }
 
 
@@ -3357,7 +3357,7 @@ bool eat_lock(void)
        /* Destroy the wall */
        cave_alter_feat(y, x, FF_HURT_ROCK);
 
-       (void)move_player_effect(y, x, MPE_DONT_PICKUP);
+       (void)move_player_effect(p_ptr, y, x, MPE_DONT_PICKUP);
        return TRUE;
 }