OSDN Git Service

[Refactor] #38993 mproc_list と mproc_max を floor_type に取り込む。 / Move mproc_list and...
authordeskull <deskull@users.sourceforge.jp>
Wed, 27 Feb 2019 05:14:27 +0000 (14:14 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Wed, 27 Feb 2019 05:14:27 +0000 (14:14 +0900)
src/dungeon.c
src/externs.h
src/floor-generate.c
src/init2.c
src/monster-status.c
src/monster2.c
src/types.h
src/variable.c

index 616a22b..613132c 100644 (file)
@@ -3598,7 +3598,7 @@ static void process_world(void)
                /* Hack -- Process the counters of monsters if needed */
                for (i = 0; i < MAX_MTIMED; i++)
                {
-                       if (mproc_max[i] > 0) process_monsters_mtimed(i);
+                       if (current_floor_ptr->mproc_max[i] > 0) process_monsters_mtimed(i);
                }
        }
 
index ed5a76e..a7bbcba 100644 (file)
@@ -261,8 +261,6 @@ extern floor_type *current_floor_ptr;
 extern saved_floor_type saved_floors[MAX_SAVED_FLOORS];
 extern FLOOR_IDX max_floor_id;
 extern u32b saved_floor_file_sign;
-extern s16b *mproc_list[MAX_MTIMED];
-extern s16b mproc_max[MAX_MTIMED];
 extern TOWN_IDX max_towns;
 extern town_type *town_info;
 extern object_type *inventory;
index 76c895e..df56003 100644 (file)
@@ -1323,7 +1323,7 @@ void clear_cave(void)
        (void)C_WIPE(current_floor_ptr->m_list, m_max, monster_type);
        m_max = 1;
        m_cnt = 0;
-       for (i = 0; i < MAX_MTIMED; i++) mproc_max[i] = 0;
+       for (i = 0; i < MAX_MTIMED; i++) current_floor_ptr->mproc_max[i] = 0;
 
        /* Pre-calc cur_num of pets in party_mon[] */
        precalc_cur_num_of_pet();
index 9200b56..a3cf8b9 100644 (file)
@@ -1229,7 +1229,7 @@ static errr init_other(void)
        /* Allocate and Wipe the monster process list */
        for (i = 0; i < MAX_MTIMED; i++)
        {
-               C_MAKE(mproc_list[i], current_floor_ptr->max_m_idx, s16b);
+               C_MAKE(current_floor_ptr->mproc_list[i], current_floor_ptr->max_m_idx, s16b);
        }
 
        /* Allocate and Wipe the max dungeon level */
index 5a3cff4..df649be 100644 (file)
@@ -146,10 +146,10 @@ static void get_exp_from_mon(HIT_POINT dam, monster_type *m_ptr)
 */
 int get_mproc_idx(MONSTER_IDX m_idx, int mproc_type)
 {
-       s16b *cur_mproc_list = mproc_list[mproc_type];
+       s16b *cur_mproc_list = current_floor_ptr->mproc_list[mproc_type];
        int i;
 
-       for (i = mproc_max[mproc_type] - 1; i >= 0; i--)
+       for (i = current_floor_ptr->mproc_max[mproc_type] - 1; i >= 0; i--)
        {
                if (cur_mproc_list[i] == m_idx) return i;
        }
@@ -165,7 +165,7 @@ int get_mproc_idx(MONSTER_IDX m_idx, int mproc_type)
 */
 static void mproc_add(MONSTER_IDX m_idx, int mproc_type)
 {
-       if (mproc_max[mproc_type] < current_floor_ptr->max_m_idx) mproc_list[mproc_type][mproc_max[mproc_type]++] = (s16b)m_idx;
+       if (current_floor_ptr->mproc_max[mproc_type] < current_floor_ptr->max_m_idx) current_floor_ptr->mproc_list[mproc_type][current_floor_ptr->mproc_max[mproc_type]++] = (s16b)m_idx;
 }
 
 
@@ -178,7 +178,7 @@ static void mproc_add(MONSTER_IDX m_idx, int mproc_type)
 static void mproc_remove(MONSTER_IDX m_idx, int mproc_type)
 {
        int mproc_idx = get_mproc_idx(m_idx, mproc_type);
-       if (mproc_idx >= 0) mproc_list[mproc_type][mproc_idx] = mproc_list[mproc_type][--mproc_max[mproc_type]];
+       if (mproc_idx >= 0) current_floor_ptr->mproc_list[mproc_type][mproc_idx] = current_floor_ptr->mproc_list[mproc_type][--current_floor_ptr->mproc_max[mproc_type]];
 }
 
 
@@ -192,8 +192,8 @@ void mproc_init(void)
        MONSTER_IDX i;
        int cmi;
 
-       /* Reset "mproc_max[]" */
-       for (cmi = 0; cmi < MAX_MTIMED; cmi++) mproc_max[cmi] = 0;
+       /* Reset "current_floor_ptr->mproc_max[]" */
+       for (cmi = 0; cmi < MAX_MTIMED; cmi++) current_floor_ptr->mproc_max[cmi] = 0;
 
        /* Process the monsters (backwards) */
        for (i = m_max - 1; i >= 1; i--)
@@ -728,13 +728,13 @@ static void process_monsters_mtimed_aux(MONSTER_IDX m_idx, int mtimed_idx)
 void process_monsters_mtimed(int mtimed_idx)
 {
        int  i;
-       s16b *cur_mproc_list = mproc_list[mtimed_idx];
+       s16b *cur_mproc_list = current_floor_ptr->mproc_list[mtimed_idx];
 
        /* Hack -- calculate the "player noise" */
        if (mtimed_idx == MTIMED_CSLEEP) csleep_noise = (1L << (30 - p_ptr->skill_stl));
 
        /* Process the monsters (backwards) */
-       for (i = mproc_max[mtimed_idx] - 1; i >= 0; i--)
+       for (i = current_floor_ptr->mproc_max[mtimed_idx] - 1; i >= 0; i--)
        {
                /* Access the monster */
                process_monsters_mtimed_aux(cur_mproc_list[i], mtimed_idx);
index e34d39a..083d6e5 100644 (file)
@@ -401,7 +401,7 @@ static void compact_monsters_aux(IDX i1, IDX i2)
        for (i = 0; i < MAX_MTIMED; i++)
        {
                int mproc_idx = get_mproc_idx(i1, i);
-               if (mproc_idx >= 0) mproc_list[i][mproc_idx] = i2;
+               if (mproc_idx >= 0) current_floor_ptr->mproc_list[i][mproc_idx] = i2;
        }
 }
 
@@ -563,8 +563,8 @@ void wipe_m_list(void)
        /* Reset "m_cnt" */
        m_cnt = 0;
 
-       /* Reset "mproc_max[]" */
-       for (i = 0; i < MAX_MTIMED; i++) mproc_max[i] = 0;
+       /* Reset "current_floor_ptr->mproc_max[]" */
+       for (i = 0; i < MAX_MTIMED; i++) current_floor_ptr->mproc_max[i] = 0;
 
        /* Hack -- reset "reproducer" count */
        current_floor_ptr->num_repro = 0;
index 59636b1..14bea7b 100644 (file)
@@ -1890,6 +1890,8 @@ typedef struct {
        monster_type *m_list; /*!< The array of dungeon monsters [current_floor_ptr->max_m_idx] */
        MONSTER_IDX max_m_idx; /*!< Maximum number of monsters in the level */
 
+       s16b *mproc_list[MAX_MTIMED]; /*!< The array to process dungeon monsters[max_m_idx] */
+       s16b mproc_max[MAX_MTIMED]; /*!< Number of monsters to be processed */
 
 } floor_type;
 
index a40964b..0481b1c 100644 (file)
@@ -482,14 +482,6 @@ FLOOR_IDX max_floor_id;
 u32b saved_floor_file_sign;
 
 
-
-/*
- * The array to process dungeon monsters [current_floor_ptr->max_m_idx]
- */
-s16b *mproc_list[MAX_MTIMED];
-s16b mproc_max[MAX_MTIMED]; /* Number of monsters to be processed */
-
-
 /*
  * Maximum number of towns
  */