OSDN Git Service

[Refactor] #38997 m_pop() にplayer_type * 引数追加 / Added player_type * argument to m_pop()
authorHourier <hourier@users.sourceforge.jp>
Sat, 18 Jan 2020 03:09:43 +0000 (12:09 +0900)
committerHourier <hourier@users.sourceforge.jp>
Sat, 18 Jan 2020 14:01:52 +0000 (23:01 +0900)
src/monster.h
src/monster2.c

index 4a39a3c..b826e71 100644 (file)
@@ -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);
index ef8fda5..6e1da62 100644 (file)
@@ -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" */