From dfd9d31e1df73b0b3b8a09ae4d860ea3a72290f7 Mon Sep 17 00:00:00 2001 From: deskull Date: Sun, 27 Oct 2019 15:19:41 +0900 Subject: [PATCH] =?utf8?q?[Refactor]=20#38997=20teleport=5Fplayer=5Faux()?= =?utf8?q?=20=E3=81=AB=20player=5Ftype=20*=20=E5=BC=95=E6=95=B0=E3=82=92?= =?utf8?q?=E8=BF=BD=E5=8A=A0=EF=BC=8E=20/=20Add=20player=5Ftype=20*=20argu?= =?utf8?q?ment=20to=20teleport=5Fplayer=5Faux().?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/core.c | 2 +- src/spells.h | 2 +- src/spells3.c | 30 +++++++++++++++--------------- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/core.c b/src/core.c index 8e5702cb5..04069c3b6 100644 --- a/src/core.c +++ b/src/core.c @@ -2206,7 +2206,7 @@ static void process_world_aux_mutation(player_type *creature_ptr) msg_print(NULL); if (one_in_(3)) lose_all_info(creature_ptr); else wiz_dark(creature_ptr); - (void)teleport_player_aux(100, TELEPORT_NONMAGICAL | TELEPORT_PASSIVE); + (void)teleport_player_aux(creature_ptr,100, TELEPORT_NONMAGICAL | TELEPORT_PASSIVE); wiz_dark(creature_ptr); msg_print(_("あなたは見知らぬ場所で目が醒めた...頭が痛い。", "You wake up somewhere with a sore head...")); msg_print(_("何も覚えていない。どうやってここに来たかも分からない!", "You can't remember a thing, or how you got here!")); diff --git a/src/spells.h b/src/spells.h index 90c854ab5..68f83a82f 100644 --- a/src/spells.h +++ b/src/spells.h @@ -284,7 +284,7 @@ extern bool concentration(player_type *creature_ptr); /* spells3.c */ extern bool teleport_away(MONSTER_IDX m_idx, POSITION dis, BIT_FLAGS mode); extern void teleport_monster_to(MONSTER_IDX m_idx, POSITION ty, POSITION tx, int power, BIT_FLAGS mode); -extern bool teleport_player_aux(POSITION dis, BIT_FLAGS mode); +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); diff --git a/src/spells3.c b/src/spells3.c index d8ddca5f2..368293afa 100644 --- a/src/spells3.c +++ b/src/spells3.c @@ -286,21 +286,21 @@ void teleport_monster_to(MONSTER_IDX m_idx, POSITION ty, POSITION tx, int power, * */ -bool teleport_player_aux(POSITION dis, BIT_FLAGS mode) +bool teleport_player_aux(player_type *creature_ptr, POSITION dis, BIT_FLAGS mode) { int candidates_at[MAX_TELEPORT_DISTANCE + 1]; int total_candidates, cur_candidates; POSITION y = 0, x = 0; int min, pick, i; - int left = MAX(1, p_ptr->x - dis); - int right = MIN(p_ptr->current_floor_ptr->width - 2, p_ptr->x + dis); - int top = MAX(1, p_ptr->y - dis); - int bottom = MIN(p_ptr->current_floor_ptr->height - 2, p_ptr->y + dis); + int left = MAX(1, creature_ptr->x - dis); + int right = MIN(creature_ptr->current_floor_ptr->width - 2, creature_ptr->x + dis); + int top = MAX(1, creature_ptr->y - dis); + int bottom = MIN(creature_ptr->current_floor_ptr->height - 2, creature_ptr->y + dis); - if (p_ptr->wild_mode) return FALSE; + if (creature_ptr->wild_mode) return FALSE; - 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 FALSE; @@ -325,7 +325,7 @@ bool teleport_player_aux(POSITION dis, BIT_FLAGS mode) if (!cave_player_teleportable_bold(y, x, mode)) continue; /* Calculate distance */ - d = distance(p_ptr->y, p_ptr->x, y, x); + d = distance(creature_ptr->y, creature_ptr->x, y, x); /* Skip too far locations */ if (d > dis) continue; @@ -364,7 +364,7 @@ bool teleport_player_aux(POSITION dis, BIT_FLAGS mode) if (!cave_player_teleportable_bold(y, x, mode)) continue; /* Calculate distance */ - d = distance(p_ptr->y, p_ptr->x, y, x); + d = distance(creature_ptr->y, creature_ptr->x, y, x); /* Skip too far locations */ if (d > dis) continue; @@ -386,11 +386,11 @@ bool teleport_player_aux(POSITION dis, BIT_FLAGS mode) sound(SOUND_TELEPORT); #ifdef JP - if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (p_ptr->inventory_list[INVEN_BOW].name1 == ART_CRIMSON)) - msg_format("『こっちだぁ、%s』", p_ptr->name); + if ((creature_ptr->pseikaku == SEIKAKU_COMBAT) || (creature_ptr->inventory_list[INVEN_BOW].name1 == ART_CRIMSON)) + msg_format("『こっちだぁ、%s』", creature_ptr->name); #endif - (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); return TRUE; } @@ -406,7 +406,7 @@ void teleport_player(POSITION dis, BIT_FLAGS mode) POSITION oy = p_ptr->y; POSITION ox = p_ptr->x; - if (!teleport_player_aux(dis, mode)) return; + if (!teleport_player_aux(p_ptr, dis, mode)) return; /* Monsters with teleport ability may follow the player */ for (xx = -1; xx < 2; xx++) @@ -448,7 +448,7 @@ void teleport_player_away(MONSTER_IDX m_idx, POSITION dis) POSITION oy = p_ptr->y; POSITION ox = p_ptr->x; - if (!teleport_player_aux(dis, TELEPORT_PASSIVE)) return; + if (!teleport_player_aux(p_ptr, dis, TELEPORT_PASSIVE)) return; /* Monsters with teleport ability may follow the player */ for (xx = -1; xx < 2; xx++) @@ -3455,7 +3455,7 @@ bool booze(player_type *creature_ptr) ident = TRUE; if (one_in_(3)) lose_all_info(p_ptr); else wiz_dark(creature_ptr); - (void)teleport_player_aux(100, TELEPORT_NONMAGICAL | TELEPORT_PASSIVE); + (void)teleport_player_aux(creature_ptr, 100, TELEPORT_NONMAGICAL | TELEPORT_PASSIVE); wiz_dark(creature_ptr); msg_print(_("知らない場所で目が醒めた。頭痛がする。", "You wake up somewhere with a sore head...")); msg_print(_("何も思い出せない。どうやってここへ来たのかも分からない!", "You can't remember a thing, or how you got here!")); -- 2.11.0