From 0f64b9545f044d134ca57f5d673241aa13c2e485 Mon Sep 17 00:00:00 2001 From: deskull Date: Fri, 27 Sep 2019 09:08:19 +0900 Subject: [PATCH] =?utf8?q?[Refactor]=20#38997=20get=5Fout=5Fmonster()=20?= =?utf8?q?=E3=81=AB=20floor=5Ftype=20*=20=E3=81=A8=20player=5Ftype=20*=20?= =?utf8?q?=E5=BC=95=E6=95=B0=E3=82=92=E8=BF=BD=E5=8A=A0=EF=BC=8E=20/=20Add?= =?utf8?q?=20floor=5Ftype=20*=20and=20player=5Ftype=20*=20arguments=20to?= =?utf8?q?=20get=5Fout=5Fmonster().?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/floor-save.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/floor-save.c b/src/floor-save.c index 0b0724214..695206da7 100644 --- a/src/floor-save.c +++ b/src/floor-save.c @@ -690,13 +690,13 @@ static void update_unique_artifact(s16b cur_floor_id) * @brief フロア移動時、プレイヤーの移動先モンスターが既にいた場合ランダムな近隣に移動させる / When a monster is at a place where player will return, * @return なし */ -static void get_out_monster(void) +static void get_out_monster(floor_type *floor_ptr, player_type *protected_ptr) { int tries = 0; POSITION dis = 1; - POSITION oy = p_ptr->y; - POSITION ox = p_ptr->x; - MONSTER_IDX m_idx = p_ptr->current_floor_ptr->grid_array[oy][ox].m_idx; + POSITION oy = protected_ptr->y; + POSITION ox = protected_ptr->x; + MONSTER_IDX m_idx = floor_ptr->grid_array[oy][ox].m_idx; /* Nothing to do if no monster */ if (!m_idx) return; @@ -722,27 +722,27 @@ static void get_out_monster(void) if (tries > 20 * dis * dis) dis++; /* Ignore illegal locations */ - if (!in_bounds(p_ptr->current_floor_ptr, ny, nx)) continue; + if (!in_bounds(floor_ptr, ny, nx)) continue; /* Require "empty" floor space */ if (!cave_empty_bold(ny, nx)) continue; /* Hack -- no teleport onto glyph of warding */ - if (is_glyph_grid(&p_ptr->current_floor_ptr->grid_array[ny][nx])) continue; - if (is_explosive_rune_grid(&p_ptr->current_floor_ptr->grid_array[ny][nx])) continue; + if (is_glyph_grid(&floor_ptr->grid_array[ny][nx])) continue; + if (is_explosive_rune_grid(&floor_ptr->grid_array[ny][nx])) continue; /* ...nor onto the Pattern */ if (pattern_tile(ny, nx)) continue; /*** It's a good place ***/ - m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx]; + m_ptr = &floor_ptr->m_list[m_idx]; /* Update the old location */ - p_ptr->current_floor_ptr->grid_array[oy][ox].m_idx = 0; + floor_ptr->grid_array[oy][ox].m_idx = 0; /* Update the new location */ - p_ptr->current_floor_ptr->grid_array[ny][nx].m_idx = m_idx; + floor_ptr->grid_array[ny][nx].m_idx = m_idx; /* Move the monster */ m_ptr->fy = ny; @@ -1061,7 +1061,7 @@ void leave_floor(player_type *creature_ptr, BIT_FLAGS floor_mode) !(floor_mode & CFM_NO_RETURN)) { /* Get out of the my way! */ - get_out_monster(); + get_out_monster(p_ptr->current_floor_ptr, creature_ptr); /* Record the last visit current_world_ptr->game_turn of current floor */ sf_ptr->last_visit = current_world_ptr->game_turn; -- 2.11.0