From: deskull Date: Tue, 30 Apr 2019 09:16:18 +0000 (+0900) Subject: [Refactor] #38993 m_cnt, m_max を floor_type 構造体に取り込み. X-Git-Url: http://git.osdn.net/view?p=hengband%2Fhengband.git;a=commitdiff_plain;h=39c0aa00ae632416a8693cc49712c498f2f3df5a [Refactor] #38993 m_cnt, m_max を floor_type 構造体に取り込み. --- diff --git a/src/bldg.c b/src/bldg.c index 087aa2ea6..270b5cb35 100644 --- a/src/bldg.c +++ b/src/bldg.c @@ -4089,7 +4089,7 @@ void do_cmd_bldg(void) } else if ((which == 2) && p_ptr->inside_arena) { - if (!p_ptr->exit_bldg && m_cnt > 0) + if (!p_ptr->exit_bldg && current_floor_ptr->m_cnt > 0) { prt(_("ゲートは閉まっている。モンスターがあなたを待っている!", "The gates are closed. The monster awaits!"), 0, 0); } diff --git a/src/cmd-activate.c b/src/cmd-activate.c index 27f9e1b22..4d388728c 100644 --- a/src/cmd-activate.c +++ b/src/cmd-activate.c @@ -434,7 +434,7 @@ void do_cmd_activate_aux(INVENTORY_IDX item) C_MAKE(who, current_floor_ptr->max_m_idx, MONSTER_IDX); /* Process the monsters (backwards) */ - for (pet_ctr = m_max - 1; pet_ctr >= 1; pet_ctr--) + for (pet_ctr = current_floor_ptr->m_max - 1; pet_ctr >= 1; pet_ctr--) { if (is_pet(¤t_floor_ptr->m_list[pet_ctr]) && (p_ptr->riding != pet_ctr)) who[max_pet++] = pet_ctr; @@ -1562,7 +1562,7 @@ bool activate_artifact(object_type *o_ptr) monster_race *r_ptr; msg_print(_("奇妙な場所が頭の中に浮かんだ...", "Some strange places show up in your mind. And you see ...")); /* Process the monsters (backwards) */ - for (i = m_max - 1; i >= 1; i--) + for (i = current_floor_ptr->m_max - 1; i >= 1; i--) { /* Access the monster */ m_ptr = ¤t_floor_ptr->m_list[i]; diff --git a/src/cmd-pet.c b/src/cmd-pet.c index 8397eaa2e..e424d93ad 100644 --- a/src/cmd-pet.c +++ b/src/cmd-pet.c @@ -74,7 +74,7 @@ PERCENTAGE calculate_upkeep(void) total_friends = 0; - for (m_idx = m_max - 1; m_idx >= 1; m_idx--) + for (m_idx = current_floor_ptr->m_max - 1; m_idx >= 1; m_idx--) { monster_type *m_ptr; monster_race *r_ptr; @@ -145,7 +145,7 @@ void do_cmd_pet_dismiss(void) C_MAKE(who, current_floor_ptr->max_m_idx, MONSTER_IDX); /* Process the monsters (backwards) */ - for (pet_ctr = m_max - 1; pet_ctr >= 1; pet_ctr--) + for (pet_ctr = current_floor_ptr->m_max - 1; pet_ctr >= 1; pet_ctr--) { if (is_pet(¤t_floor_ptr->m_list[pet_ctr])) who[max_pet++] = pet_ctr; @@ -814,7 +814,7 @@ void do_cmd_pet(void) case PET_DISMISS: /* Dismiss pets */ { /* Check pets (backwards) */ - for (pet_ctr = m_max - 1; pet_ctr >= 1; pet_ctr--) + for (pet_ctr = current_floor_ptr->m_max - 1; pet_ctr >= 1; pet_ctr--) { /* Player has pet */ if (is_pet(¤t_floor_ptr->m_list[pet_ctr])) break; @@ -892,7 +892,7 @@ void do_cmd_pet(void) if (p_ptr->pet_extra_flags & PF_PICKUP_ITEMS) { p_ptr->pet_extra_flags &= ~(PF_PICKUP_ITEMS); - for (pet_ctr = m_max - 1; pet_ctr >= 1; pet_ctr--) + for (pet_ctr = current_floor_ptr->m_max - 1; pet_ctr >= 1; pet_ctr--) { /* Access the monster */ m_ptr = ¤t_floor_ptr->m_list[pet_ctr]; diff --git a/src/cmd4.c b/src/cmd4.c index 63e4db9ab..436e471ef 100644 --- a/src/cmd4.c +++ b/src/cmd4.c @@ -5714,7 +5714,7 @@ static void do_cmd_knowledge_pets(void) } /* Process the monsters (backwards) */ - for (i = m_max - 1; i >= 1; i--) + for (i = current_floor_ptr->m_max - 1; i >= 1; i--) { /* Access the monster */ m_ptr = ¤t_floor_ptr->m_list[i]; diff --git a/src/core.c b/src/core.c index 6272e6788..bf151315d 100644 --- a/src/core.c +++ b/src/core.c @@ -883,7 +883,7 @@ static void regen_monsters(void) /* Regenerate everyone */ - for (i = 1; i < m_max; i++) + for (i = 1; i < current_floor_ptr->m_max; i++) { /* Check the i'th monster */ monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; @@ -2432,7 +2432,7 @@ static void process_world_aux_mutation(void) int danger_amount = 0; MONSTER_IDX monster; - for (monster = 0; monster < m_max; monster++) + for (monster = 0; monster < current_floor_ptr->m_max; monster++) { monster_type *m_ptr = ¤t_floor_ptr->m_list[monster]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; @@ -4404,7 +4404,7 @@ static void process_player(void) if (p_ptr->inside_battle) { - for(m_idx = 1; m_idx < m_max; m_idx++) + for(m_idx = 1; m_idx < current_floor_ptr->m_max; m_idx++) { monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx]; @@ -4766,7 +4766,7 @@ static void process_player(void) shimmer_monsters = FALSE; /* Shimmer multi-hued monsters */ - for (m_idx = 1; m_idx < m_max; m_idx++) + for (m_idx = 1; m_idx < current_floor_ptr->m_max; m_idx++) { monster_type *m_ptr; monster_race *r_ptr; @@ -4800,7 +4800,7 @@ static void process_player(void) repair_monsters = FALSE; /* Rotate detection flags */ - for (m_idx = 1; m_idx < m_max; m_idx++) + for (m_idx = 1; m_idx < current_floor_ptr->m_max; m_idx++) { monster_type *m_ptr; m_ptr = ¤t_floor_ptr->m_list[m_idx]; @@ -5078,10 +5078,10 @@ static void dungeon(bool load_game) while (TRUE) { /* Hack -- Compact the monster list occasionally */ - if ((m_cnt + 32 > current_floor_ptr->max_m_idx) && !p_ptr->inside_battle) compact_monsters(64); + if ((current_floor_ptr->m_cnt + 32 > current_floor_ptr->max_m_idx) && !p_ptr->inside_battle) compact_monsters(64); /* Hack -- Compress the monster list occasionally */ - if ((m_cnt + 32 < m_max) && !p_ptr->inside_battle) compact_monsters(0); + if ((current_floor_ptr->m_cnt + 32 < current_floor_ptr->m_max) && !p_ptr->inside_battle) compact_monsters(0); /* Hack -- Compact the object list occasionally */ @@ -5452,7 +5452,7 @@ void play_game(bool new_game) if (p_ptr->riding == -1) { p_ptr->riding = 0; - for (i = m_max; i > 0; i--) + for (i = current_floor_ptr->m_max; i > 0; i--) { if (player_bold(current_floor_ptr->m_list[i].fy, current_floor_ptr->m_list[i].fx)) { diff --git a/src/externs.h b/src/externs.h index d2331f37c..61f1e98f7 100644 --- a/src/externs.h +++ b/src/externs.h @@ -159,8 +159,6 @@ extern bool shimmer_monsters; extern bool shimmer_objects; extern bool repair_monsters; extern bool repair_objects; -extern MONSTER_IDX m_max; -extern MONSTER_IDX m_cnt; extern MONSTER_IDX hack_m_idx; extern MONSTER_IDX hack_m_idx_ii; extern int total_friends; diff --git a/src/files.c b/src/files.c index 62fc3f372..70cd58ccf 100644 --- a/src/files.c +++ b/src/files.c @@ -4199,7 +4199,7 @@ static void dump_aux_pet(FILE *fff) bool pet_settings = FALSE; GAME_TEXT pet_name[MAX_NLEN]; - for (i = m_max - 1; i >= 1; i--) + for (i = current_floor_ptr->m_max - 1; i >= 1; i--) { monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; diff --git a/src/floor-events.c b/src/floor-events.c index b4bca96bf..a74367fac 100644 --- a/src/floor-events.c +++ b/src/floor-events.c @@ -150,7 +150,7 @@ byte get_dungeon_feeling(void) if (!current_floor_ptr->dun_level) return 0; /* Examine each monster */ - for (i = 1; i < m_max; i++) + for (i = 1; i < current_floor_ptr->m_max; i++) { monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; monster_race *r_ptr; @@ -1529,7 +1529,7 @@ void update_mon_lite(void) monster_race *r_ptr; /* Loop through monsters, adding newly lit squares to changes list */ - for (i = 1; i < m_max; i++) + for (i = 1; i < current_floor_ptr->m_max; i++) { m_ptr = ¤t_floor_ptr->m_list[i]; r_ptr = &r_info[m_ptr->r_idx]; diff --git a/src/floor-generate.c b/src/floor-generate.c index 976020a16..3b2757986 100644 --- a/src/floor-generate.c +++ b/src/floor-generate.c @@ -1183,7 +1183,7 @@ static void generate_gambling_arena(void) place_monster_aux(0, p_ptr->y + 8 + (i/2)*4, p_ptr->x - 2 + (i%2)*4, battle_mon[i], (PM_NO_KAGE | PM_NO_PET)); set_friendly(¤t_floor_ptr->m_list[current_floor_ptr->grid_array[p_ptr->y+8+(i/2)*4][p_ptr->x-2+(i%2)*4].m_idx]); } - for(i = 1; i < m_max; i++) + for(i = 1; i < current_floor_ptr->m_max; i++) { monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; @@ -1337,9 +1337,9 @@ void clear_cave(void) /* Very simplified version of wipe_m_list() */ for (i = 1; i < max_r_idx; i++) r_info[i].cur_num = 0; - (void)C_WIPE(current_floor_ptr->m_list, m_max, monster_type); - m_max = 1; - m_cnt = 0; + (void)C_WIPE(current_floor_ptr->m_list, current_floor_ptr->m_max, monster_type); + current_floor_ptr->m_max = 1; + current_floor_ptr->m_cnt = 0; for (i = 0; i < MAX_MTIMED; i++) current_floor_ptr->mproc_max[i] = 0; /* Pre-calc cur_num of pets in party_mon[] */ @@ -1441,7 +1441,7 @@ void generate_random_floor(void) okay = FALSE; } /* Prevent monster over-flow */ - else if (m_max >= current_floor_ptr->max_m_idx) + else if (current_floor_ptr->m_max >= current_floor_ptr->max_m_idx) { why = _("モンスターが多すぎる", "too many monsters"); okay = FALSE; diff --git a/src/floor-save.c b/src/floor-save.c index d161d1846..288de4508 100644 --- a/src/floor-save.c +++ b/src/floor-save.c @@ -402,7 +402,7 @@ static void preserve_pet(void) */ if (!p_ptr->wild_mode && !p_ptr->inside_arena && !p_ptr->inside_battle) { - for (i = m_max - 1, num = 1; (i >= 1 && num < MAX_PARTY_MON); i--) + for (i = current_floor_ptr->m_max - 1, num = 1; (i >= 1 && num < MAX_PARTY_MON); i--) { monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; @@ -451,7 +451,7 @@ static void preserve_pet(void) if (record_named_pet) { - for (i = m_max - 1; i >=1; i--) + for (i = current_floor_ptr->m_max - 1; i >=1; i--) { monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; GAME_TEXT m_name[MAX_NLEN]; @@ -468,7 +468,7 @@ static void preserve_pet(void) /* Pet of other pet may disappear. */ - for (i = m_max - 1; i >=1; i--) + for (i = current_floor_ptr->m_max - 1; i >=1; i--) { monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; @@ -639,7 +639,7 @@ static void update_unique_artifact(s16b cur_floor_id) int i; /* Maintain unique monsters */ - for (i = 1; i < m_max; i++) + for (i = 1; i < current_floor_ptr->m_max; i++) { monster_race *r_ptr; monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; @@ -889,7 +889,7 @@ void leave_floor(void) } /* Maintain quest monsters */ - for (i = 1; i < m_max; i++) + for (i = 1; i < current_floor_ptr->m_max; i++) { monster_race *r_ptr; monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; @@ -1198,7 +1198,7 @@ void change_floor(void) absence_ticks = (current_world_ptr->game_turn - tmp_last_visit) / TURNS_PER_TICK; /* Maintain monsters */ - for (i = 1; i < m_max; i++) + for (i = 1; i < current_floor_ptr->m_max; i++) { monster_race *r_ptr; monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; diff --git a/src/floor.h b/src/floor.h index a578254f5..b0e65d9c0 100644 --- a/src/floor.h +++ b/src/floor.h @@ -21,6 +21,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 */ + MONSTER_IDX m_max; /* Number of allocated monsters */ + MONSTER_IDX m_cnt; /* Number of live monsters */ 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 */ diff --git a/src/monster-process.c b/src/monster-process.c index d97c795cd..9056d1d81 100644 --- a/src/monster-process.c +++ b/src/monster-process.c @@ -70,15 +70,15 @@ static bool get_enemy_dir(MONSTER_IDX m_idx, int *mm) { if (p_ptr->inside_battle) { - start = randint1(m_max-1)+m_max; + start = randint1(current_floor_ptr->m_max-1)+current_floor_ptr->m_max; if(randint0(2)) plus = -1; } - else start = m_max + 1; + else start = current_floor_ptr->m_max + 1; /* Scan thru all monsters */ - for (i = start; ((i < start + m_max) && (i > start - m_max)); i+=plus) + for (i = start; ((i < start + current_floor_ptr->m_max) && (i > start - current_floor_ptr->m_max)); i+=plus) { - MONSTER_IDX dummy = (i % m_max); + MONSTER_IDX dummy = (i % current_floor_ptr->m_max); if (!dummy) continue; @@ -3176,7 +3176,7 @@ void process_monsters(void) /* Process the monsters (backwards) */ - for (i = m_max - 1; i >= 1; i--) + for (i = current_floor_ptr->m_max - 1; i >= 1; i--) { /* Access the monster */ m_ptr = ¤t_floor_ptr->m_list[i]; diff --git a/src/monster-status.c b/src/monster-status.c index 40fb1b247..fe3df2568 100644 --- a/src/monster-status.c +++ b/src/monster-status.c @@ -232,7 +232,7 @@ void mproc_init(void) 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--) + for (i = current_floor_ptr->m_max - 1; i >= 1; i--) { /* Access the monster */ m_ptr = ¤t_floor_ptr->m_list[i]; diff --git a/src/monster2.c b/src/monster2.c index 28084b6a3..78ef50e9a 100644 --- a/src/monster2.c +++ b/src/monster2.c @@ -153,7 +153,7 @@ void delete_monster_idx(MONSTER_IDX i) (void)WIPE(m_ptr, monster_type); /* Count monsters */ - m_cnt--; + current_floor_ptr->m_cnt--; lite_spot(y, x); if (r_ptr->flags7 & (RF7_LITE_MASK | RF7_DARK_MASK)) @@ -238,7 +238,7 @@ static void compact_monsters_aux(MONSTER_IDX i1, MONSTER_IDX i2) /* Hack -- Update parent index */ if (is_pet(m_ptr)) { - for (i = 1; i < m_max; i++) + for (i = 1; i < current_floor_ptr->m_max; i++) { monster_type *m2_ptr = ¤t_floor_ptr->m_list[i]; @@ -295,7 +295,7 @@ void compact_monsters(int size) cur_dis = 5 * (20 - cnt); /* Check all the monsters */ - for (i = 1; i < m_max; i++) + for (i = 1; i < current_floor_ptr->m_max; i++) { monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; @@ -340,7 +340,7 @@ void compact_monsters(int size) /* Excise dead monsters (backwards!) */ - for (i = m_max - 1; i >= 1; i--) + for (i = current_floor_ptr->m_max - 1; i >= 1; i--) { /* Get the i'th monster */ monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; @@ -349,10 +349,10 @@ void compact_monsters(int size) if (m_ptr->r_idx) continue; /* Move last monster into open hole */ - compact_monsters_aux(m_max - 1, i); + compact_monsters_aux(current_floor_ptr->m_max - 1, i); - /* Compress "m_max" */ - m_max--; + /* Compress "current_floor_ptr->m_max" */ + current_floor_ptr->m_max--; } } @@ -388,7 +388,7 @@ void wipe_m_list(void) } /* Delete all the monsters */ - for (i = m_max - 1; i >= 1; i--) + for (i = current_floor_ptr->m_max - 1; i >= 1; i--) { monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; if (!monster_is_valid(m_ptr)) continue; @@ -409,11 +409,11 @@ void wipe_m_list(void) /* Hack -- Wipe the racial counter of all monster races */ for (i = 1; i < max_r_idx; i++) r_info[i].cur_num = 0; - /* Reset "m_max" */ - m_max = 1; + /* Reset "current_floor_ptr->m_max" */ + current_floor_ptr->m_max = 1; - /* Reset "m_cnt" */ - m_cnt = 0; + /* Reset "current_floor_ptr->m_cnt" */ + current_floor_ptr->m_cnt = 0; /* Reset "current_floor_ptr->mproc_max[]" */ for (i = 0; i < MAX_MTIMED; i++) current_floor_ptr->mproc_max[i] = 0; @@ -442,23 +442,23 @@ MONSTER_IDX m_pop(void) MONSTER_IDX i; /* Normal allocation */ - if (m_max < current_floor_ptr->max_m_idx) + if (current_floor_ptr->m_max < current_floor_ptr->max_m_idx) { /* Access the next hole */ - i = m_max; + i = current_floor_ptr->m_max; /* Expand the array */ - m_max++; + current_floor_ptr->m_max++; /* Count monsters */ - m_cnt++; + current_floor_ptr->m_cnt++; /* Return the index */ return (i); } /* Recycle dead monsters */ - for (i = 1; i < m_max; i++) + for (i = 1; i < current_floor_ptr->m_max; i++) { monster_type *m_ptr; @@ -469,7 +469,7 @@ MONSTER_IDX m_pop(void) if (m_ptr->r_idx) continue; /* Count monsters */ - m_cnt++; + current_floor_ptr->m_cnt++; /* Use this monster */ return (i); @@ -2188,7 +2188,7 @@ void update_monsters(bool full) MONSTER_IDX i; /* Update each (live) monster */ - for (i = 1; i < m_max; i++) + for (i = 1; i < current_floor_ptr->m_max; i++) { monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; if (!monster_is_valid(m_ptr)) continue; diff --git a/src/mspells2.c b/src/mspells2.c index f803487ff..5a41c532c 100644 --- a/src/mspells2.c +++ b/src/mspells2.c @@ -356,15 +356,15 @@ bool monst_spell_monst(MONSTER_IDX m_idx) if (p_ptr->inside_battle) { - start = randint1(m_max-1) + m_max; + start = randint1(current_floor_ptr->m_max-1) + current_floor_ptr->m_max; if (randint0(2)) plus = -1; } - else start = m_max + 1; + else start = current_floor_ptr->m_max + 1; /* Scan thru all monsters */ - for (i = start; ((i < start + m_max) && (i > start - m_max)); i += plus) + for (i = start; ((i < start + current_floor_ptr->m_max) && (i > start - current_floor_ptr->m_max)); i += plus) { - MONSTER_IDX dummy = (i % m_max); + MONSTER_IDX dummy = (i % current_floor_ptr->m_max); if (!dummy) continue; target_idx = dummy; diff --git a/src/mspells4.c b/src/mspells4.c index 2ecf08c07..af799fc74 100644 --- a/src/mspells4.c +++ b/src/mspells4.c @@ -1965,7 +1965,7 @@ HIT_POINT spell_RF6_SPECIAL_BANORLUPART(MONSTER_IDX m_idx) if (!r_info[MON_BANOR].cur_num || !r_info[MON_LUPART].cur_num) return -1; - for (k = 1; k < m_max; k++) + for (k = 1; k < current_floor_ptr->m_max; k++) { if (current_floor_ptr->m_list[k].r_idx == MON_BANOR || current_floor_ptr->m_list[k].r_idx == MON_LUPART) { diff --git a/src/player-status.c b/src/player-status.c index 20ba4a6f0..6ac44c11a 100644 --- a/src/player-status.c +++ b/src/player-status.c @@ -2920,7 +2920,7 @@ static void calc_alignment(void) p_ptr->align = 0; int i, j, neutral[2]; - for (m_idx = m_max - 1; m_idx >= 1; m_idx--) + for (m_idx = current_floor_ptr->m_max - 1; m_idx >= 1; m_idx--) { monster_type *m_ptr; monster_race *r_ptr; diff --git a/src/save.c b/src/save.c index b02a22ce6..b519a495c 100644 --- a/src/save.c +++ b/src/save.c @@ -1086,10 +1086,10 @@ static void wr_saved_floor(saved_floor_type *sf_ptr) /*** Dump the monsters ***/ /* Total monsters */ - wr_u16b(m_max); + wr_u16b(current_floor_ptr->m_max); /* Dump the monsters */ - for (i = 1; i < m_max; i++) + for (i = 1; i < current_floor_ptr->m_max; i++) { monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; diff --git a/src/spells-summon.c b/src/spells-summon.c index e6031cc97..a4348fee5 100644 --- a/src/spells-summon.c +++ b/src/spells-summon.c @@ -410,7 +410,7 @@ void mitokohmon(void) } if (!count) { - for (i = m_max - 1; i > 0; i--) + for (i = current_floor_ptr->m_max - 1; i > 0; i--) { m_ptr = ¤t_floor_ptr->m_list[i]; if (!monster_is_valid(m_ptr)) continue; diff --git a/src/spells2.c b/src/spells2.c index 296cd4770..31329e7d0 100644 --- a/src/spells2.c +++ b/src/spells2.c @@ -384,7 +384,7 @@ bool detect_monsters_normal(POSITION range) if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3; - for (i = 1; i < m_max; i++) + for (i = 1; i < current_floor_ptr->m_max; i++) { monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; @@ -430,7 +430,7 @@ bool detect_monsters_invis(POSITION range) if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3; - for (i = 1; i < m_max; i++) + for (i = 1; i < current_floor_ptr->m_max; i++) { monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; @@ -482,7 +482,7 @@ bool detect_monsters_evil(POSITION range) if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3; - for (i = 1; i < m_max; i++) + for (i = 1; i < current_floor_ptr->m_max; i++) { monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; @@ -537,7 +537,7 @@ bool detect_monsters_nonliving(POSITION range) if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3; - for (i = 1; i < m_max; i++) + for (i = 1; i < current_floor_ptr->m_max; i++) { monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; if (!monster_is_valid(m_ptr)) continue; @@ -585,7 +585,7 @@ bool detect_monsters_mind(POSITION range) if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3; - for (i = 1; i < m_max; i++) + for (i = 1; i < current_floor_ptr->m_max; i++) { monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; @@ -636,7 +636,7 @@ bool detect_monsters_string(POSITION range, concptr Match) if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3; - for (i = 1; i < m_max; i++) + for (i = 1; i < current_floor_ptr->m_max; i++) { monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; @@ -689,7 +689,7 @@ bool detect_monsters_xxx(POSITION range, u32b match_flag) if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3; - for (i = 1; i < m_max; i++) + for (i = 1; i < current_floor_ptr->m_max; i++) { monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; @@ -789,7 +789,7 @@ bool project_all_los(EFFECT_ID typ, HIT_POINT dam) bool obvious = FALSE; /* Mark all (nearby) monsters */ - for (i = 1; i < m_max; i++) + for (i = 1; i < current_floor_ptr->m_max; i++) { monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; if (!monster_is_valid(m_ptr)) continue; @@ -805,7 +805,7 @@ bool project_all_los(EFFECT_ID typ, HIT_POINT dam) } /* Affect all marked monsters */ - for (i = 1; i < m_max; i++) + for (i = 1; i < current_floor_ptr->m_max; i++) { monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; @@ -977,7 +977,7 @@ void aggravate_monsters(MONSTER_IDX who) bool speed = FALSE; /* Aggravate everyone nearby */ - for (i = 1; i < m_max; i++) + for (i = 1; i < current_floor_ptr->m_max; i++) { monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; if (!monster_is_valid(m_ptr)) continue; @@ -1125,7 +1125,7 @@ bool symbol_genocide(int power, bool player_cast) while (!get_com(_("どの種類(文字)のモンスターを抹殺しますか: ", "Choose a monster race (by symbol) to genocide: "), &typ, FALSE)) ; /* Delete the monsters of that "type" */ - for (i = 1; i < m_max; i++) + for (i = 1; i < current_floor_ptr->m_max; i++) { monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; @@ -1165,7 +1165,7 @@ bool mass_genocide(int power, bool player_cast) } /* Delete the (nearby) monsters */ - for (i = 1; i < m_max; i++) + for (i = 1; i < current_floor_ptr->m_max; i++) { monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; if (!monster_is_valid(m_ptr)) continue; @@ -1205,7 +1205,7 @@ bool mass_genocide_undead(int power, bool player_cast) } /* Delete the (nearby) monsters */ - for (i = 1; i < m_max; i++) + for (i = 1; i < current_floor_ptr->m_max; i++) { monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; @@ -1249,7 +1249,7 @@ bool probing(void) Term->scr->cv = 1; /* Probe all (nearby) monsters */ - for (i = 1; i < m_max; i++) + for (i = 1; i < current_floor_ptr->m_max; i++) { monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; monster_race *r_ptr = &r_info[m_ptr->r_idx]; @@ -2106,7 +2106,7 @@ void discharge_minion(void) MONSTER_IDX i; bool okay = TRUE; - for (i = 1; i < m_max; i++) + for (i = 1; i < current_floor_ptr->m_max; i++) { monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; if (!m_ptr->r_idx || !is_pet(m_ptr)) continue; @@ -2117,7 +2117,7 @@ void discharge_minion(void) if (!get_check(_("本当に全ペットを爆破しますか?", "You will blast all pets. Are you sure? "))) return; } - for (i = 1; i < m_max; i++) + for (i = 1; i < current_floor_ptr->m_max; i++) { HIT_POINT dam; monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; diff --git a/src/variable.c b/src/variable.c index be3a7b6b4..f898b571d 100644 --- a/src/variable.c +++ b/src/variable.c @@ -141,10 +141,6 @@ bool repair_objects; /* Hack -- optimize detect objects */ bool is_loading_now; /*!< ロード直後にcalc_bonus()時の徳変化、及びsanity_blast()による異常を抑止する */ bool hack_mutation; - -MONSTER_IDX m_max = 1; /* Number of allocated monsters */ -MONSTER_IDX m_cnt = 0; /* Number of live monsters */ - MONSTER_IDX hack_m_idx = 0; /* Hack -- see "process_monsters()" */ MONSTER_IDX hack_m_idx_ii = 0; diff --git a/src/wild.c b/src/wild.c index 0d0ed6ae2..d9bcd121b 100644 --- a/src/wild.c +++ b/src/wild.c @@ -1141,7 +1141,7 @@ bool change_wild_mode(void) return TRUE; } - for (i = 1; i < m_max; i++) + for (i = 1; i < current_floor_ptr->m_max; i++) { monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; diff --git a/src/wizard2.c b/src/wizard2.c index 1e9c23bd3..619bb690e 100644 --- a/src/wizard2.c +++ b/src/wizard2.c @@ -1468,7 +1468,7 @@ static void do_cmd_wiz_zap(void) MONSTER_IDX i; /* Genocide everyone nearby */ - for (i = 1; i < m_max; i++) + for (i = 1; i < current_floor_ptr->m_max; i++) { monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; if (!monster_is_valid(m_ptr)) continue; @@ -1503,7 +1503,7 @@ static void do_cmd_wiz_zap_all(void) MONSTER_IDX i; /* Genocide everyone */ - for (i = 1; i < m_max; i++) + for (i = 1; i < current_floor_ptr->m_max; i++) { monster_type *m_ptr = ¤t_floor_ptr->m_list[i]; if (!monster_is_valid(m_ptr)) continue;