From: deskull Date: Wed, 27 Feb 2019 05:14:27 +0000 (+0900) Subject: [Refactor] #38993 mproc_list と mproc_max を floor_type に取り込む。 / Move mproc_list and... X-Git-Tag: vmacos2.2.1-7a~626 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=f3fef78ab5c4a566b4f5dec4bf250665bf2ce702;p=hengbandforosx%2Fhengbandosx.git [Refactor] #38993 mproc_list と mproc_max を floor_type に取り込む。 / Move mproc_list and pmroc_max to floor_type structure. --- diff --git a/src/dungeon.c b/src/dungeon.c index 616a22b64..613132ca0 100644 --- a/src/dungeon.c +++ b/src/dungeon.c @@ -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); } } diff --git a/src/externs.h b/src/externs.h index ed5a76e80..a7bbcbacc 100644 --- a/src/externs.h +++ b/src/externs.h @@ -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; diff --git a/src/floor-generate.c b/src/floor-generate.c index 76c895ecd..df5600338 100644 --- a/src/floor-generate.c +++ b/src/floor-generate.c @@ -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(); diff --git a/src/init2.c b/src/init2.c index 9200b56c5..a3cf8b940 100644 --- a/src/init2.c +++ b/src/init2.c @@ -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 */ diff --git a/src/monster-status.c b/src/monster-status.c index 5a3cff4eb..df649bec0 100644 --- a/src/monster-status.c +++ b/src/monster-status.c @@ -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); diff --git a/src/monster2.c b/src/monster2.c index e34d39ae6..083d6e5bc 100644 --- a/src/monster2.c +++ b/src/monster2.c @@ -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; diff --git a/src/types.h b/src/types.h index 59636b110..14bea7bb2 100644 --- a/src/types.h +++ b/src/types.h @@ -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; diff --git a/src/variable.c b/src/variable.c index a40964bb7..0481b1c93 100644 --- a/src/variable.c +++ b/src/variable.c @@ -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 */