From 07cef3f70996e8d5d18177a131629a990ac92a95 Mon Sep 17 00:00:00 2001 From: deskull Date: Mon, 16 Dec 2019 01:20:41 +0900 Subject: [PATCH] =?utf8?q?[Refactor]=20#38997=20teleport=5Faway=5Ffollowab?= =?utf8?q?le()=20=E3=81=AB=20player=5Ftype=20*=20=E5=BC=95=E6=95=B0?= =?utf8?q?=E3=82=92=E8=BF=BD=E5=8A=A0=EF=BC=8E=20/=20Add=20player=5Ftype?= =?utf8?q?=20*=20argument=20to=20teleport=5Faway=5Ffollowable().?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/mspells4.c | 2 +- src/spells.h | 2 +- src/spells3.c | 18 +++++++++--------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/mspells4.c b/src/mspells4.c index 4149a29ca..d188eff0e 100644 --- a/src/mspells4.c +++ b/src/mspells4.c @@ -1906,7 +1906,7 @@ void spell_RF6_TPORT(MONSTER_IDX m_idx, int TARGET_TYPE) if(see_monster(m_idx)) msg_format(_("%^sがテレポートした。", "%^s teleports away."), m_name); - teleport_away_followable(m_idx); + teleport_away_followable(p_ptr, m_idx); } } diff --git a/src/spells.h b/src/spells.h index bf7cb8439..87c6a357b 100644 --- a/src/spells.h +++ b/src/spells.h @@ -289,7 +289,7 @@ extern bool teleport_player_aux(player_type *creature_ptr, POSITION dis, BIT_FLA extern void teleport_player(player_type *creature_ptr, POSITION dis, BIT_FLAGS mode); extern void teleport_player_away(MONSTER_IDX m_idx, POSITION dis); 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 void teleport_away_followable(player_type *creature_ptr, MONSTER_IDX m_idx); extern bool teleport_level_other(player_type *caster_ptr); extern void teleport_level(player_type *creature_ptr, MONSTER_IDX m_idx); extern bool recall_player(player_type *creature_ptr, TIME_EFFECT turns); diff --git a/src/spells3.c b/src/spells3.c index 03c725e59..7ee750fd9 100644 --- a/src/spells3.c +++ b/src/spells3.c @@ -532,21 +532,21 @@ void teleport_player_to(player_type *creature_ptr, POSITION ny, POSITION nx, BIT } -void teleport_away_followable(MONSTER_IDX m_idx) +void teleport_away_followable(player_type *tracer_ptr, MONSTER_IDX m_idx) { - monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; + monster_type *m_ptr = &tracer_ptr->current_floor_ptr->m_list[m_idx]; POSITION oldfy = m_ptr->fy; POSITION oldfx = m_ptr->fx; bool old_ml = m_ptr->ml; POSITION old_cdis = m_ptr->cdis; - teleport_away(p_ptr, m_idx, MAX_SIGHT * 2 + 5, 0L); + teleport_away(tracer_ptr, m_idx, MAX_SIGHT * 2 + 5, 0L); - if (old_ml && (old_cdis <= MAX_SIGHT) && !current_world_ptr->timewalk_m_idx && !p_ptr->phase_out && los(p_ptr->current_floor_ptr, p_ptr->y, p_ptr->x, oldfy, oldfx)) + if (old_ml && (old_cdis <= MAX_SIGHT) && !current_world_ptr->timewalk_m_idx && !tracer_ptr->phase_out && los(tracer_ptr->current_floor_ptr, tracer_ptr->y, tracer_ptr->x, oldfy, oldfx)) { bool follow = FALSE; - if ((p_ptr->muta1 & MUT1_VTELEPORT) || (p_ptr->pclass == CLASS_IMITATOR)) follow = TRUE; + if ((tracer_ptr->muta1 & MUT1_VTELEPORT) || (tracer_ptr->pclass == CLASS_IMITATOR)) follow = TRUE; else { BIT_FLAGS flgs[TR_FLAG_SIZE]; @@ -555,7 +555,7 @@ void teleport_away_followable(MONSTER_IDX m_idx) for (i = INVEN_RARM; i < INVEN_TOTAL; i++) { - o_ptr = &p_ptr->inventory_list[i]; + o_ptr = &tracer_ptr->inventory_list[i]; if (o_ptr->k_idx && !object_is_cursed(o_ptr)) { object_flags(o_ptr, flgs); @@ -574,11 +574,11 @@ void teleport_away_followable(MONSTER_IDX m_idx) { if (one_in_(3)) { - teleport_player(p_ptr, 200, TELEPORT_PASSIVE); + teleport_player(tracer_ptr, 200, TELEPORT_PASSIVE); msg_print(_("失敗!", "Failed!")); } - else teleport_player_to(p_ptr, m_ptr->fy, m_ptr->fx, 0L); - p_ptr->energy_need += ENERGY_NEED(); + else teleport_player_to(tracer_ptr, m_ptr->fy, m_ptr->fx, 0L); + tracer_ptr->energy_need += ENERGY_NEED(); } } } -- 2.11.0