OSDN Git Service

[Refactor] #38997 count_all_hostile_monsters() に floor_type * 引数を追加.
authordeskull <deskull@users.sourceforge.jp>
Tue, 20 Aug 2019 11:00:11 +0000 (20:00 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Tue, 20 Aug 2019 11:00:11 +0000 (20:00 +0900)
src/floor-events.c
src/floor-events.h
src/quest.c

index cf9f525..2f2fd00 100644 (file)
@@ -108,18 +108,18 @@ void night_falls(void)
  * @brief 現在フロアに残っている敵モンスターの数を返す /
  * @return 現在の敵モンスターの数
  */
-MONSTER_NUMBER count_all_hostile_monsters(void)
+MONSTER_NUMBER count_all_hostile_monsters(floor_type *floor_ptr)
 {
        POSITION x, y;
        MONSTER_NUMBER number_mon = 0;
 
-       for (x = 0; x < current_floor_ptr->width; ++x)
+       for (x = 0; x < floor_ptr->width; ++x)
        {
-               for (y = 0; y < current_floor_ptr->height; ++y)
+               for (y = 0; y < floor_ptr->height; ++y)
                {
-                       MONSTER_IDX m_idx = current_floor_ptr->grid_array[y][x].m_idx;
+                       MONSTER_IDX m_idx = floor_ptr->grid_array[y][x].m_idx;
 
-                       if (m_idx > 0 && is_hostile(&current_floor_ptr->m_list[m_idx]))
+                       if (m_idx > 0 && is_hostile(&floor_ptr->m_list[m_idx]))
                        {
                                ++number_mon;
                        }
index 26acdb9..ef7e50b 100644 (file)
@@ -1,7 +1,7 @@
 
 extern void day_break(void);
 extern void night_falls(void);
-extern MONSTER_NUMBER count_all_hostile_monsters(void);
+extern MONSTER_NUMBER count_all_hostile_monsters(floor_type *floor_ptr);
 extern byte get_dungeon_feeling(void);
 extern void update_dungeon_feeling(void);
 extern void glow_deep_lava_and_bldg(void);
index b3752f6..7704764 100644 (file)
@@ -200,7 +200,7 @@ void check_quest_completion(monster_type *m_ptr)
                {
                        if (!is_hostile(m_ptr)) break;
 
-                       if (count_all_hostile_monsters() == 1)
+                       if (count_all_hostile_monsters(current_floor_ptr) == 1)
                        {
                                if (q_ptr->flags & QUEST_FLAG_SILENT)
                                {
@@ -260,7 +260,7 @@ void check_quest_completion(monster_type *m_ptr)
                {
                        if (!is_hostile(m_ptr)) break;
 
-                       if (count_all_hostile_monsters() == 1)
+                       if (count_all_hostile_monsters(current_floor_ptr) == 1)
                        {
                                q_ptr->status = QUEST_STATUS_STAGE_COMPLETED;