OSDN Git Service

[Refactor] #38997 teleport_player_to() に player_type * 引数を追加. / Add player_type ...
authordeskull <deskull@users.sourceforge.jp>
Wed, 6 Nov 2019 04:26:12 +0000 (13:26 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Wed, 6 Nov 2019 04:26:12 +0000 (13:26 +0900)
src/mspells4.c
src/realm-hex.c
src/realm-hissatsu.c
src/spells-status.c
src/spells.h
src/spells2.c
src/spells3.c
src/wizard2.c

index 1e32882..20558e4 100644 (file)
@@ -2070,7 +2070,7 @@ HIT_POINT spell_RF6_SPECIAL_B(POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTER
                dam = damroll(4, 8);
 
                if (monster_to_player || t_idx == p_ptr->riding)
-                       teleport_player_to(m_ptr->fy, m_ptr->fx, TELEPORT_NONMAGICAL | TELEPORT_PASSIVE);
+                       teleport_player_to(p_ptr, m_ptr->fy, m_ptr->fx, TELEPORT_NONMAGICAL | TELEPORT_PASSIVE);
                else 
                        teleport_monster_to(t_idx, m_ptr->fy, m_ptr->fx, 100, TELEPORT_NONMAGICAL | TELEPORT_PASSIVE);
 
@@ -2184,7 +2184,7 @@ void spell_RF6_TELE_TO(MONSTER_IDX m_idx, MONSTER_IDX t_idx, int TARGET_TYPE)
        
        if (TARGET_TYPE == MONSTER_TO_PLAYER)
        {
-               teleport_player_to(m_ptr->fy, m_ptr->fx, TELEPORT_PASSIVE);
+               teleport_player_to(p_ptr, m_ptr->fy, m_ptr->fx, TELEPORT_PASSIVE);
                learn_spell(MS_TELE_TO);
        }
        else if (TARGET_TYPE == MONSTER_TO_MONSTER)
@@ -2218,7 +2218,7 @@ void spell_RF6_TELE_TO(MONSTER_IDX m_idx, MONSTER_IDX t_idx, int TARGET_TYPE)
                if (!resists_tele)
                {
                        if (t_idx == p_ptr->riding) 
-                               teleport_player_to(m_ptr->fy, m_ptr->fx, TELEPORT_PASSIVE);
+                               teleport_player_to(p_ptr, m_ptr->fy, m_ptr->fx, TELEPORT_PASSIVE);
                        else 
                                teleport_monster_to(t_idx, m_ptr->fy, m_ptr->fx, 100, TELEPORT_PASSIVE);
                }
index 437a5eb..96f29f1 100644 (file)
@@ -1037,7 +1037,7 @@ concptr do_hex_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mode)
 
                        if (flag && randint0(plev * plev / 2))
                        {
-                               teleport_player_to(y, x, 0L);
+                               teleport_player_to(caster_ptr, y, x, 0L);
                        }
                        else
                        {
index 00f5816..521619d 100644 (file)
@@ -811,7 +811,7 @@ concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mo
                                break;
                        }
                        project(0, 0, y, x, HISSATSU_ISSEN, GF_ATTACK, PROJECT_BEAM | PROJECT_KILL, -1);
-                       teleport_player_to(y, x, 0L);
+                       teleport_player_to(caster_ptr, y, x, 0L);
                }
                break;
 
index e90a177..9820c15 100644 (file)
@@ -494,7 +494,7 @@ void apply_nexus(monster_type *m_ptr, player_type *target_ptr)
 
        case 4: case 5:
        {
-               teleport_player_to(m_ptr->fy, m_ptr->fx, TELEPORT_PASSIVE);
+               teleport_player_to(p_ptr, m_ptr->fy, m_ptr->fx, TELEPORT_PASSIVE);
                break;
        }
 
index 1904077..5f54cc8 100644 (file)
@@ -287,7 +287,7 @@ extern void teleport_monster_to(MONSTER_IDX m_idx, POSITION ty, POSITION tx, int
 extern bool teleport_player_aux(player_type *creature_ptr, POSITION dis, BIT_FLAGS mode);
 extern void teleport_player(POSITION dis, BIT_FLAGS mode);
 extern void teleport_player_away(MONSTER_IDX m_idx, POSITION dis);
-extern void teleport_player_to(POSITION ny, POSITION nx, BIT_FLAGS mode);
+extern void teleport_player_to(player_type *creature_ptr, POSITION ny, POSITION nx, BIT_FLAGS mode);
 extern void teleport_away_followable(MONSTER_IDX m_idx);
 extern bool teleport_level_other(player_type *creature_ptr);
 extern void teleport_level(player_type *creature_ptr, MONSTER_IDX m_idx);
index 3b909e1..ba7723a 100644 (file)
@@ -3064,7 +3064,7 @@ bool rush_attack(bool *mdeath)
                }
 
                /* Move player before updating the monster */
-               if (!player_bold(p_ptr, ty, tx)) teleport_player_to(ty, tx, TELEPORT_NONMAGICAL);
+               if (!player_bold(p_ptr, ty, tx)) teleport_player_to(p_ptr, ty, tx, TELEPORT_NONMAGICAL);
                update_monster(p_ptr->current_floor_ptr->grid_array[ny][nx].m_idx, TRUE);
 
                /* Found a monster */
@@ -3088,14 +3088,14 @@ bool rush_attack(bool *mdeath)
                        msg_format(_("素早く%sの懐に入り込んだ!", "You quickly jump in and attack %s!"), m_name);
                }
 
-               if (!player_bold(p_ptr, ty, tx)) teleport_player_to(ty, tx, TELEPORT_NONMAGICAL);
+               if (!player_bold(p_ptr, ty, tx)) teleport_player_to(p_ptr, ty, tx, TELEPORT_NONMAGICAL);
                moved = TRUE;
                tmp_mdeath = py_attack(p_ptr, ny, nx, HISSATSU_NYUSIN);
 
                break;
        }
 
-       if (!moved && !player_bold(p_ptr, ty, tx)) teleport_player_to(ty, tx, TELEPORT_NONMAGICAL);
+       if (!moved && !player_bold(p_ptr, ty, tx)) teleport_player_to(p_ptr, ty, tx, TELEPORT_NONMAGICAL);
 
        if (mdeath) *mdeath = tmp_mdeath;
        return TRUE;
index 61c81df..e135d97 100644 (file)
@@ -491,12 +491,12 @@ void teleport_player_away(MONSTER_IDX m_idx, POSITION dis)
  * This function allows teleporting into vaults (!)
  * </pre>
  */
-void teleport_player_to(POSITION ny, POSITION nx, BIT_FLAGS mode)
+void teleport_player_to(player_type *creature_ptr, POSITION ny, POSITION nx, BIT_FLAGS mode)
 {
        POSITION y, x;
        POSITION dis = 0, ctr = 0;
 
-       if (p_ptr->anti_tele && !(mode & TELEPORT_NONMAGICAL))
+       if (creature_ptr->anti_tele && !(mode & TELEPORT_NONMAGICAL))
        {
                msg_print(_("不思議な力がテレポートを防いだ!", "A mysterious force prevents you from teleporting!"));
                return;
@@ -510,11 +510,11 @@ void teleport_player_to(POSITION ny, POSITION nx, BIT_FLAGS mode)
                {
                        y = (POSITION)rand_spread(ny, dis);
                        x = (POSITION)rand_spread(nx, dis);
-                       if (in_bounds(p_ptr->current_floor_ptr, y, x)) break;
+                       if (in_bounds(creature_ptr->current_floor_ptr, y, x)) break;
                }
 
                /* Accept any grid when wizard mode */
-               if (current_world_ptr->wizard && !(mode & TELEPORT_PASSIVE) && (!p_ptr->current_floor_ptr->grid_array[y][x].m_idx || (p_ptr->current_floor_ptr->grid_array[y][x].m_idx == p_ptr->riding))) break;
+               if (current_world_ptr->wizard && !(mode & TELEPORT_PASSIVE) && (!creature_ptr->current_floor_ptr->grid_array[y][x].m_idx || (creature_ptr->current_floor_ptr->grid_array[y][x].m_idx == creature_ptr->riding))) break;
 
                /* Accept teleportable floor grids */
                if (cave_player_teleportable_bold(y, x, mode)) break;
@@ -528,7 +528,7 @@ void teleport_player_to(POSITION ny, POSITION nx, BIT_FLAGS mode)
        }
 
        sound(SOUND_TELEPORT);
-       (void)move_player_effect(p_ptr, y, x, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP);
+       (void)move_player_effect(creature_ptr, y, x, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP);
 }
 
 
@@ -577,7 +577,7 @@ void teleport_away_followable(MONSTER_IDX m_idx)
                                        teleport_player(200, TELEPORT_PASSIVE);
                                        msg_print(_("失敗!", "Failed!"));
                                }
-                               else teleport_player_to(m_ptr->fy, m_ptr->fx, 0L);
+                               else teleport_player_to(p_ptr, m_ptr->fy, m_ptr->fx, 0L);
                                p_ptr->energy_need += ENERGY_NEED();
                        }
                }
@@ -2967,7 +2967,7 @@ static bool dimension_door_aux(DEPTH x, DEPTH y)
        }
        else
        {
-               teleport_player_to(y, x, 0L);
+               teleport_player_to(p_ptr, y, x, 0L);
 
                /* Success */
                return TRUE;
index 1bae898..0db5edb 100644 (file)
@@ -62,7 +62,7 @@ static bool wiz_dimension_door(void)
 {
        POSITION x = 0, y = 0;
        if (!tgt_pt(&x, &y)) return FALSE;
-       teleport_player_to(y, x, TELEPORT_NONMAGICAL);
+       teleport_player_to(p_ptr, y, x, TELEPORT_NONMAGICAL);
        return (TRUE);
 }
 
@@ -279,7 +279,7 @@ static void do_cmd_wiz_bamf(void)
        if (!target_who) return;
 
        /* Teleport to the target */
-       teleport_player_to(target_row, target_col, TELEPORT_NONMAGICAL);
+       teleport_player_to(p_ptr, target_row, target_col, TELEPORT_NONMAGICAL);
 }