OSDN Git Service

[Refactor] #38997 teleport_swap() に player_type * 引数を追加. / Add player_type * argument...
authordeskull <deskull@users.sourceforge.jp>
Fri, 3 Jan 2020 14:48:42 +0000 (23:48 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Fri, 3 Jan 2020 14:48:42 +0000 (23:48 +0900)
src/mind.c
src/mutation.c
src/realm-trump.c
src/spells.h
src/spells2.c

index 4b682dc..a575f1c 100644 (file)
@@ -1709,7 +1709,7 @@ static bool cast_ninja_spell(player_type *caster_ptr, int spell)
                }
                project_length = 0;
 
-               (void)teleport_swap(dir);
+               (void)teleport_swap(caster_ptr, dir);
                break;
        case 15:
                explosive_rune(caster_ptr->current_floor_ptr, caster_ptr->y, caster_ptr->x);
index 18d809b..24c89b4 100644 (file)
@@ -2164,7 +2164,7 @@ bool exe_mutation_power(player_type *creature_ptr, int power)
                                project_length = 0;
                                return FALSE;
                        }
-                       (void)teleport_swap(dir);
+                       (void)teleport_swap(creature_ptr, dir);
                        project_length = 0;
                        break;
 
index fab670f..c3ae2e4 100644 (file)
@@ -347,7 +347,7 @@ concptr do_trump_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mode)
 
                                if (!result) return NULL;
 
-                               teleport_swap(dir);
+                               teleport_swap(caster_ptr, dir);
                        }
                }
                break;
index 89adc7c..b1cc1fa 100644 (file)
@@ -240,7 +240,7 @@ extern bool control_one_undead(DIRECTION dir, PLAYER_LEVEL plev);
 extern bool control_one_demon(DIRECTION dir, PLAYER_LEVEL plev);
 extern bool charm_animal(DIRECTION dir, PLAYER_LEVEL plev);
 extern bool mindblast_monsters(HIT_POINT dam);
-extern bool teleport_swap(DIRECTION dir);
+extern bool teleport_swap(player_type *caster_ptr, DIRECTION dir);
 extern bool project_hook(player_type *caster_ptr, EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, BIT_FLAGS flg);
 extern bool project_all_los(player_type *caster_ptr, EFFECT_ID typ, HIT_POINT dam);
 extern bool eat_magic(player_type *caster_ptr, int power);
index 83f0f77..74ae97f 100644 (file)
@@ -2135,7 +2135,7 @@ bool fire_blast(player_type *caster_ptr, EFFECT_ID typ, DIRECTION dir, DICE_NUMB
  * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
  * @return 作用が実際にあった場合TRUEを返す
  */
-bool teleport_swap(DIRECTION dir)
+bool teleport_swap(player_type *caster_ptr, DIRECTION dir)
 {
        POSITION tx, ty;
        grid_type* g_ptr;
@@ -2149,30 +2149,30 @@ bool teleport_swap(DIRECTION dir)
        }
        else
        {
-               tx = p_ptr->x + ddx[dir];
-               ty = p_ptr->y + ddy[dir];
+               tx = caster_ptr->x + ddx[dir];
+               ty = caster_ptr->y + ddy[dir];
        }
-       g_ptr = &p_ptr->current_floor_ptr->grid_array[ty][tx];
+       g_ptr = &caster_ptr->current_floor_ptr->grid_array[ty][tx];
 
-       if (p_ptr->anti_tele)
+       if (caster_ptr->anti_tele)
        {
                msg_print(_("不思議な力がテレポートを防いだ!", "A mysterious force prevents you from teleporting!"));
                return FALSE;
        }
 
-       if (!g_ptr->m_idx || (g_ptr->m_idx == p_ptr->riding))
+       if (!g_ptr->m_idx || (g_ptr->m_idx == caster_ptr->riding))
        {
                msg_print(_("それとは場所を交換できません。", "You can't trade places with that!"));
                return FALSE;
        }
 
-       if ((g_ptr->info & CAVE_ICKY) || (distance(ty, tx, p_ptr->y, p_ptr->x) > p_ptr->lev * 3 / 2 + 10))
+       if ((g_ptr->info & CAVE_ICKY) || (distance(ty, tx, caster_ptr->y, caster_ptr->x) > caster_ptr->lev * 3 / 2 + 10))
        {
                msg_print(_("失敗した。", "Failed to swap."));
                return FALSE;
        }
 
-       m_ptr = &p_ptr->current_floor_ptr->m_list[g_ptr->m_idx];
+       m_ptr = &caster_ptr->current_floor_ptr->m_list[g_ptr->m_idx];
        r_ptr = &r_info[m_ptr->r_idx];
 
        (void)set_monster_csleep(g_ptr->m_idx, 0);
@@ -2187,7 +2187,7 @@ bool teleport_swap(DIRECTION dir)
        sound(SOUND_TELEPORT);
 
        /* Swap the player and monster */
-       (void)move_player_effect(p_ptr, ty, tx, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP);
+       (void)move_player_effect(caster_ptr, ty, tx, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP);
 
        /* Success */
        return TRUE;