From be967ae0d97a854a80ef28d14c14b869ab2b8d38 Mon Sep 17 00:00:00 2001 From: Hourier Date: Sat, 18 Jan 2020 12:09:43 +0900 Subject: [PATCH] =?utf8?q?[Refactor]=20#38997=20m=5Fpop()=20=E3=81=ABplaye?= =?utf8?q?r=5Ftype=20*=20=E5=BC=95=E6=95=B0=E8=BF=BD=E5=8A=A0=20/=20Added?= =?utf8?q?=20player=5Ftype=20*=20argument=20to=20m=5Fpop()?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/monster.h | 2 +- src/monster2.c | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/monster.h b/src/monster.h index 4a39a3c3f..b826e718c 100644 --- a/src/monster.h +++ b/src/monster.h @@ -471,7 +471,7 @@ extern MONRACE_IDX real_r_idx(monster_type *m_ptr); extern void delete_monster_idx(MONSTER_IDX i); extern void compact_monsters(player_type *player_ptr, int size); extern void wipe_monsters_list(player_type *player_ptr); -extern MONSTER_IDX m_pop(void); +extern MONSTER_IDX m_pop(player_type *player_ptr); extern errr get_mon_num_prep(monsterrace_hook_type monster_hook, monsterrace_hook_type monster_hook2); extern MONRACE_IDX get_mon_num(DEPTH level); extern int lore_do_probe(MONRACE_IDX r_idx); diff --git a/src/monster2.c b/src/monster2.c index ef8fda55c..6e1da6228 100644 --- a/src/monster2.c +++ b/src/monster2.c @@ -356,6 +356,7 @@ void compact_monsters(player_type *player_ptr, int size) /*! + * todo ここには本来floor_type*を追加したいが、monster.hにfloor.hの参照を追加するとコンパイルエラーが出るので保留 * @brief プレイヤーのフロア離脱に伴う全モンスター配列の消去 / Delete/Remove all the monsters when the player leaves the level * @param player_ptr プレーヤーへの参照ポインタ * @return なし @@ -437,12 +438,12 @@ void wipe_monsters_list(player_type *player_ptr) * @details * This routine should almost never fail, but it *can* happen. */ -MONSTER_IDX m_pop(void) +MONSTER_IDX m_pop(player_type *player_ptr) { MONSTER_IDX i; /* Normal allocation */ - floor_type *floor_ptr = p_ptr->current_floor_ptr; + floor_type *floor_ptr = player_ptr->current_floor_ptr; if (floor_ptr->m_max < current_world_ptr->max_m_idx) { /* Access the next hole */ @@ -2614,7 +2615,7 @@ static bool place_monster_one(player_type *player_ptr, MONSTER_IDX who, POSITION if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_NAZGUL) || (r_ptr->level < 10)) mode &= ~PM_KAGE; /* Make a new monster */ - g_ptr->m_idx = m_pop(); + g_ptr->m_idx = m_pop(player_ptr); hack_m_idx_ii = g_ptr->m_idx; /* Mega-Hack -- catch "failure" */ -- 2.11.0