OSDN Git Service

[Refactor] #38997 teleport_player_away() に player_type * 引数を追加. / Add player_type...
authordeskull <deskull@users.sourceforge.jp>
Fri, 3 Jan 2020 14:14:06 +0000 (23:14 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Fri, 3 Jan 2020 14:14:06 +0000 (23:14 +0900)
src/mspells4.c
src/spells.h
src/spells3.c

index 5b45b88..b15effc 100644 (file)
@@ -2258,7 +2258,7 @@ void spell_RF6_TELE_AWAY(MONSTER_IDX m_idx, MONSTER_IDX t_idx, int TARGET_TYPE)
                }
 
                learn_spell(MS_TELE_AWAY);
-               teleport_player_away(m_idx, 100);
+               teleport_player_away(m_idx, p_ptr, 100);
        }
        else if (TARGET_TYPE == MONSTER_TO_MONSTER)
        {
@@ -2291,7 +2291,7 @@ void spell_RF6_TELE_AWAY(MONSTER_IDX m_idx, MONSTER_IDX t_idx, int TARGET_TYPE)
                if (!resists_tele)
                {
                        if (t_idx == p_ptr->riding) 
-                               teleport_player_away(m_idx, MAX_SIGHT * 2 + 5);
+                               teleport_player_away(m_idx, p_ptr, MAX_SIGHT * 2 + 5);
                        else 
                                teleport_away(p_ptr, t_idx, MAX_SIGHT * 2 + 5, TELEPORT_PASSIVE);
                }
index d98caaa..bcb7b00 100644 (file)
@@ -287,7 +287,7 @@ extern bool teleport_away(player_type *caster_ptr, MONSTER_IDX m_idx, POSITION d
 extern void teleport_monster_to(MONSTER_IDX m_idx, POSITION ty, POSITION tx, int power, BIT_FLAGS mode);
 extern bool teleport_player_aux(player_type *creature_ptr, POSITION dis, BIT_FLAGS mode);
 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_away(MONSTER_IDX m_idx, player_type *target_ptr, POSITION dis);
 extern void teleport_player_to(player_type *creature_ptr, POSITION ny, POSITION nx, BIT_FLAGS mode);
 extern void teleport_away_followable(player_type *creature_ptr, MONSTER_IDX m_idx);
 extern bool teleport_level_other(player_type *caster_ptr);
index b2bd088..6df3798 100644 (file)
@@ -439,25 +439,25 @@ void teleport_player(player_type *creature_ptr, POSITION dis, BIT_FLAGS mode)
  * @param dis テレポート距離
  * @return なし
  */
-void teleport_player_away(MONSTER_IDX m_idx, POSITION dis)
+void teleport_player_away(MONSTER_IDX m_idx, player_type *target_ptr, POSITION dis)
 {
        POSITION yy, xx;
-       POSITION oy = p_ptr->y;
-       POSITION ox = p_ptr->x;
+       POSITION oy = target_ptr->y;
+       POSITION ox = target_ptr->x;
 
-       if (!teleport_player_aux(p_ptr, dis, TELEPORT_PASSIVE)) return;
+       if (!teleport_player_aux(target_ptr, dis, TELEPORT_PASSIVE)) return;
 
        /* Monsters with teleport ability may follow the player */
        for (xx = -1; xx < 2; xx++)
        {
                for (yy = -1; yy < 2; yy++)
                {
-                       MONSTER_IDX tmp_m_idx = p_ptr->current_floor_ptr->grid_array[oy+yy][ox+xx].m_idx;
+                       MONSTER_IDX tmp_m_idx = target_ptr->current_floor_ptr->grid_array[oy+yy][ox+xx].m_idx;
 
                        /* A monster except your mount or caster may follow */
-                       if (tmp_m_idx && (p_ptr->riding != tmp_m_idx) && (m_idx != tmp_m_idx))
+                       if (tmp_m_idx && (target_ptr->riding != tmp_m_idx) && (m_idx != tmp_m_idx))
                        {
-                               monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[tmp_m_idx];
+                               monster_type *m_ptr = &target_ptr->current_floor_ptr->m_list[tmp_m_idx];
                                monster_race *r_ptr = &r_info[m_ptr->r_idx];
 
                                /*
@@ -467,7 +467,7 @@ void teleport_player_away(MONSTER_IDX m_idx, POSITION dis)
                                if ((r_ptr->a_ability_flags2 & RF6_TPORT) &&
                                    !(r_ptr->flagsr & RFR_RES_TELE))
                                {
-                                       if (!MON_CSLEEP(m_ptr)) teleport_monster_to(tmp_m_idx, p_ptr->y, p_ptr->x, r_ptr->level, 0L);
+                                       if (!MON_CSLEEP(m_ptr)) teleport_monster_to(tmp_m_idx, target_ptr->y, target_ptr->x, r_ptr->level, 0L);
                                }
                        }
                }