OSDN Git Service

[Refactor] #37353 cmd4.c を cmd-dump.c に改名して関数整理.
[hengband/hengband.git] / src / floor-generate.c
index df56003..acf2c26 100644 (file)
  */
 
 #include "angband.h"
-#include "generate.h"
+#include "util.h"
+#include "bldg.h"
+
+#include "cmd-dump.h"
 #include "grid.h"
 #include "rooms.h"
+#include "dungeon.h"
+#include "floor.h"
+#include "floor-save.h"
 #include "floor-streams.h"
+#include "floor-generate.h"
+#include "floor-events.h"
+#include "floor-generate.h"
+#include "feature.h"
 #include "trap.h"
 #include "monster.h"
 #include "quest.h"
 #include "player-status.h"
 #include "wild.h"
+#include "monster-status.h"
+#include "dungeon-file.h"
+#include "init.h"
+#include "feature.h"
+#include "spells.h"
 
 int dun_tun_rnd; 
 int dun_tun_chg;
@@ -170,7 +185,7 @@ static bool alloc_stairs_aux(POSITION y, POSITION x, int walls)
  * @param walls 最低減隣接させたい外壁の数
  * @return 規定数通りに生成に成功したらTRUEを返す。
  */
-static bool alloc_stairs(IDX feat, int num, int walls)
+static bool alloc_stairs(FEAT_IDX feat, int num, int walls)
 {
        int i;
        int shaft_num = 0;
@@ -205,8 +220,6 @@ static bool alloc_stairs(IDX feat, int num, int walls)
                if ((current_floor_ptr->dun_level < d_info[p_ptr->dungeon_idx].maxdepth-1) && !quest_number(current_floor_ptr->dun_level+1))
                        shaft_num = (randint1(num)+1)/2;
        }
-
-       /* Paranoia */
        else return FALSE;
 
 
@@ -561,6 +574,11 @@ static bool cave_gen(void)
        POSITION y, x;
        dun_data dun_body;
 
+       current_floor_ptr->lite_n = 0;
+       current_floor_ptr->mon_lite_n = 0;
+       current_floor_ptr->redraw_n = 0;
+       current_floor_ptr->view_n = 0;
+
        /* Global data */
        dun = &dun_body;
 
@@ -661,7 +679,7 @@ static bool cave_gen(void)
                int tunnel_fail_count = 0;
 
                /*
-                * Build each type of room in turn until we cannot build any more.
+                * Build each type of room in current_world_ptr->game_turn until we cannot build any more.
                 */
                if (!generate_rooms()) return FALSE;
 
@@ -1166,11 +1184,11 @@ 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];
 
-               if (!m_ptr->r_idx) continue;
+               if (!monster_is_valid(m_ptr)) continue;
 
                m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
                update_monster(i, FALSE);
@@ -1313,16 +1331,16 @@ void clear_cave(void)
        int i;
 
        /* Very simplified version of wipe_o_list() */
-       (void)C_WIPE(current_floor_ptr->o_list, o_max, object_type);
-       o_max = 1;
-       o_cnt = 0;
+       (void)C_WIPE(current_floor_ptr->o_list, current_floor_ptr->o_max, object_type);
+       current_floor_ptr->o_max = 1;
+       current_floor_ptr->o_cnt = 0;
 
        /* 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[] */
@@ -1418,13 +1436,13 @@ void generate_random_floor(void)
 
 
                /* Prevent object over-flow */
-               if (o_max >= current_floor_ptr->max_o_idx)
+               if (current_floor_ptr->o_max >= current_floor_ptr->max_o_idx)
                {
                        why = _("アイテムが多すぎる", "too many objects");
                        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;
@@ -1585,8 +1603,6 @@ bool build_tunnel(POSITION row1, POSITION col1, POSITION row2, POSITION col2)
                        tmp_col = col1 + col_dir;
                }
 
-
-               /* Access the location */
                g_ptr = &current_floor_ptr->grid_array[tmp_row][tmp_col];
 
                /* Avoid "solid" walls */