• R/O
  • HTTP
  • SSH
  • HTTPS

hengband: Commit

変愚蛮怒のメインリポジトリです


Commit MetaInfo

Revisionf3fef78ab5c4a566b4f5dec4bf250665bf2ce702 (tree)
Time2019-02-27 14:14:27
Authordeskull <deskull@user...>
Commiterdeskull

Log Message

[Refactor] #38993 mproc_list と mproc_max を floor_type に取り込む。 / Move mproc_list and pmroc_max to floor_type structure.

Change Summary

Incremental Difference

--- a/src/dungeon.c
+++ b/src/dungeon.c
@@ -3598,7 +3598,7 @@ static void process_world(void)
35983598 /* Hack -- Process the counters of monsters if needed */
35993599 for (i = 0; i < MAX_MTIMED; i++)
36003600 {
3601- if (mproc_max[i] > 0) process_monsters_mtimed(i);
3601+ if (current_floor_ptr->mproc_max[i] > 0) process_monsters_mtimed(i);
36023602 }
36033603 }
36043604
--- a/src/externs.h
+++ b/src/externs.h
@@ -261,8 +261,6 @@ extern floor_type *current_floor_ptr;
261261 extern saved_floor_type saved_floors[MAX_SAVED_FLOORS];
262262 extern FLOOR_IDX max_floor_id;
263263 extern u32b saved_floor_file_sign;
264-extern s16b *mproc_list[MAX_MTIMED];
265-extern s16b mproc_max[MAX_MTIMED];
266264 extern TOWN_IDX max_towns;
267265 extern town_type *town_info;
268266 extern object_type *inventory;
--- a/src/floor-generate.c
+++ b/src/floor-generate.c
@@ -1323,7 +1323,7 @@ void clear_cave(void)
13231323 (void)C_WIPE(current_floor_ptr->m_list, m_max, monster_type);
13241324 m_max = 1;
13251325 m_cnt = 0;
1326- for (i = 0; i < MAX_MTIMED; i++) mproc_max[i] = 0;
1326+ for (i = 0; i < MAX_MTIMED; i++) current_floor_ptr->mproc_max[i] = 0;
13271327
13281328 /* Pre-calc cur_num of pets in party_mon[] */
13291329 precalc_cur_num_of_pet();
--- a/src/init2.c
+++ b/src/init2.c
@@ -1229,7 +1229,7 @@ static errr init_other(void)
12291229 /* Allocate and Wipe the monster process list */
12301230 for (i = 0; i < MAX_MTIMED; i++)
12311231 {
1232- C_MAKE(mproc_list[i], current_floor_ptr->max_m_idx, s16b);
1232+ C_MAKE(current_floor_ptr->mproc_list[i], current_floor_ptr->max_m_idx, s16b);
12331233 }
12341234
12351235 /* Allocate and Wipe the max dungeon level */
--- 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)
146146 */
147147 int get_mproc_idx(MONSTER_IDX m_idx, int mproc_type)
148148 {
149- s16b *cur_mproc_list = mproc_list[mproc_type];
149+ s16b *cur_mproc_list = current_floor_ptr->mproc_list[mproc_type];
150150 int i;
151151
152- for (i = mproc_max[mproc_type] - 1; i >= 0; i--)
152+ for (i = current_floor_ptr->mproc_max[mproc_type] - 1; i >= 0; i--)
153153 {
154154 if (cur_mproc_list[i] == m_idx) return i;
155155 }
@@ -165,7 +165,7 @@ int get_mproc_idx(MONSTER_IDX m_idx, int mproc_type)
165165 */
166166 static void mproc_add(MONSTER_IDX m_idx, int mproc_type)
167167 {
168- if (mproc_max[mproc_type] < current_floor_ptr->max_m_idx) mproc_list[mproc_type][mproc_max[mproc_type]++] = (s16b)m_idx;
168+ 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;
169169 }
170170
171171
@@ -178,7 +178,7 @@ static void mproc_add(MONSTER_IDX m_idx, int mproc_type)
178178 static void mproc_remove(MONSTER_IDX m_idx, int mproc_type)
179179 {
180180 int mproc_idx = get_mproc_idx(m_idx, mproc_type);
181- if (mproc_idx >= 0) mproc_list[mproc_type][mproc_idx] = mproc_list[mproc_type][--mproc_max[mproc_type]];
181+ 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]];
182182 }
183183
184184
@@ -192,8 +192,8 @@ void mproc_init(void)
192192 MONSTER_IDX i;
193193 int cmi;
194194
195- /* Reset "mproc_max[]" */
196- for (cmi = 0; cmi < MAX_MTIMED; cmi++) mproc_max[cmi] = 0;
195+ /* Reset "current_floor_ptr->mproc_max[]" */
196+ for (cmi = 0; cmi < MAX_MTIMED; cmi++) current_floor_ptr->mproc_max[cmi] = 0;
197197
198198 /* Process the monsters (backwards) */
199199 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)
728728 void process_monsters_mtimed(int mtimed_idx)
729729 {
730730 int i;
731- s16b *cur_mproc_list = mproc_list[mtimed_idx];
731+ s16b *cur_mproc_list = current_floor_ptr->mproc_list[mtimed_idx];
732732
733733 /* Hack -- calculate the "player noise" */
734734 if (mtimed_idx == MTIMED_CSLEEP) csleep_noise = (1L << (30 - p_ptr->skill_stl));
735735
736736 /* Process the monsters (backwards) */
737- for (i = mproc_max[mtimed_idx] - 1; i >= 0; i--)
737+ for (i = current_floor_ptr->mproc_max[mtimed_idx] - 1; i >= 0; i--)
738738 {
739739 /* Access the monster */
740740 process_monsters_mtimed_aux(cur_mproc_list[i], mtimed_idx);
--- a/src/monster2.c
+++ b/src/monster2.c
@@ -401,7 +401,7 @@ static void compact_monsters_aux(IDX i1, IDX i2)
401401 for (i = 0; i < MAX_MTIMED; i++)
402402 {
403403 int mproc_idx = get_mproc_idx(i1, i);
404- if (mproc_idx >= 0) mproc_list[i][mproc_idx] = i2;
404+ if (mproc_idx >= 0) current_floor_ptr->mproc_list[i][mproc_idx] = i2;
405405 }
406406 }
407407
@@ -563,8 +563,8 @@ void wipe_m_list(void)
563563 /* Reset "m_cnt" */
564564 m_cnt = 0;
565565
566- /* Reset "mproc_max[]" */
567- for (i = 0; i < MAX_MTIMED; i++) mproc_max[i] = 0;
566+ /* Reset "current_floor_ptr->mproc_max[]" */
567+ for (i = 0; i < MAX_MTIMED; i++) current_floor_ptr->mproc_max[i] = 0;
568568
569569 /* Hack -- reset "reproducer" count */
570570 current_floor_ptr->num_repro = 0;
--- a/src/types.h
+++ b/src/types.h
@@ -1890,6 +1890,8 @@ typedef struct {
18901890 monster_type *m_list; /*!< The array of dungeon monsters [current_floor_ptr->max_m_idx] */
18911891 MONSTER_IDX max_m_idx; /*!< Maximum number of monsters in the level */
18921892
1893+ s16b *mproc_list[MAX_MTIMED]; /*!< The array to process dungeon monsters[max_m_idx] */
1894+ s16b mproc_max[MAX_MTIMED]; /*!< Number of monsters to be processed */
18931895
18941896 } floor_type;
18951897
--- a/src/variable.c
+++ b/src/variable.c
@@ -482,14 +482,6 @@ FLOOR_IDX max_floor_id;
482482 u32b saved_floor_file_sign;
483483
484484
485-
486-/*
487- * The array to process dungeon monsters [current_floor_ptr->max_m_idx]
488- */
489-s16b *mproc_list[MAX_MTIMED];
490-s16b mproc_max[MAX_MTIMED]; /* Number of monsters to be processed */
491-
492-
493485 /*
494486 * Maximum number of towns
495487 */
Show on old repository browser