OSDN Git Service

[Refactor] #38993 m_cnt, m_max を floor_type 構造体に取り込み.
authordeskull <deskull@users.sourceforge.jp>
Tue, 30 Apr 2019 09:16:18 +0000 (18:16 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Tue, 30 Apr 2019 10:36:35 +0000 (19:36 +0900)
23 files changed:
src/bldg.c
src/cmd-activate.c
src/cmd-pet.c
src/cmd4.c
src/core.c
src/externs.h
src/files.c
src/floor-events.c
src/floor-generate.c
src/floor-save.c
src/floor.h
src/monster-process.c
src/monster-status.c
src/monster2.c
src/mspells2.c
src/mspells4.c
src/player-status.c
src/save.c
src/spells-summon.c
src/spells2.c
src/variable.c
src/wild.c
src/wizard2.c

index 087aa2e..270b5cb 100644 (file)
@@ -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);
                }
index 27f9e1b..4d38872 100644 (file)
@@ -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(&current_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 = &current_floor_ptr->m_list[i];
index 8397eaa..e424d93 100644 (file)
@@ -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(&current_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(&current_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 = &current_floor_ptr->m_list[pet_ctr];
index 63e4db9..436e471 100644 (file)
@@ -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 = &current_floor_ptr->m_list[i];
index 6272e67..bf15131 100644 (file)
@@ -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 = &current_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 = &current_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 = &current_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 = &current_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))
                                {
index d2331f3..61f1e98 100644 (file)
@@ -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;
index 62fc3f3..70cd58c 100644 (file)
@@ -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 = &current_floor_ptr->m_list[i];
 
index b4bca96..a74367f 100644 (file)
@@ -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 = &current_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 = &current_floor_ptr->m_list[i];
                        r_ptr = &r_info[m_ptr->r_idx];
index 976020a..3b27579 100644 (file)
@@ -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(&current_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 = &current_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;
index d161d18..288de45 100644 (file)
@@ -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 = &current_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 = &current_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 = &current_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 = &current_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 = &current_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 = &current_floor_ptr->m_list[i];
index a578254..b0e65d9 100644 (file)
@@ -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 */
index d97c795..9056d1d 100644 (file)
@@ -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 = &current_floor_ptr->m_list[i];
index 40fb1b2..fe3df25 100644 (file)
@@ -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 = &current_floor_ptr->m_list[i];
index 28084b6..78ef50e 100644 (file)
@@ -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 = &current_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 = &current_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 = &current_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 = &current_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 = &current_floor_ptr->m_list[i];
                if (!monster_is_valid(m_ptr)) continue;
index f803487..5a41c53 100644 (file)
@@ -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;
index 2ecf08c..af799fc 100644 (file)
@@ -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)
                                {
index 20ba4a6..6ac44c1 100644 (file)
@@ -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;
index b02a22c..b519a49 100644 (file)
@@ -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 = &current_floor_ptr->m_list[i];
 
index e6031cc..a4348fe 100644 (file)
@@ -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 = &current_floor_ptr->m_list[i];
                        if (!monster_is_valid(m_ptr)) continue;
index 296cd47..31329e7 100644 (file)
@@ -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 = &current_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 = &current_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 = &current_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 = &current_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 = &current_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 = &current_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 = &current_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 = &current_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 = &current_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 = &current_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 = &current_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 = &current_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 = &current_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 = &current_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 = &current_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 = &current_floor_ptr->m_list[i];
index be3a7b6..f898b57 100644 (file)
@@ -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;
 
index 0d0ed6a..d9bcd12 100644 (file)
@@ -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 = &current_floor_ptr->m_list[i];
 
index 1e9c23b..619bb69 100644 (file)
@@ -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 = &current_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 = &current_floor_ptr->m_list[i];
                if (!monster_is_valid(m_ptr)) continue;