OSDN Git Service

[Refactor] #37353 Visual Studio 2017 の C4701警告潰し。/ Fix warning C4701 in Visual Studio...
[hengband/hengband.git] / src / rooms.c
index 023017f..be495ea 100644 (file)
@@ -49,6 +49,8 @@
 #include "rooms-trap.h"
 #include "rooms-vault.h"
 
+#include "trap.h"
+
 
 /*!
  * 各部屋タイプの生成比定義
@@ -87,6 +89,7 @@ static room_info_type room_info_normal[ROOM_T_MAX] =
        {{  0,  0,  1,  1,  1,  2,  3,  4,  5,  6,  8}, 20}, /*TRAP     */
        {{  0,  0,  0,  0,  1,  1,  1,  2,  2,  2,  2}, 40}, /*GLASS    */
        {{  1,  1,  1,  1,  1,  1,  1,  2,  2,  3,  3},  1}, /*ARCADE   */
+       {{ 20, 40, 60, 80,100,100,100,100,100,100,100},  1}, /*FIX   */
 };
 
 
@@ -107,78 +110,11 @@ static byte room_build_order[ROOM_T_MAX] = {
        ROOM_T_OVERLAP,
        ROOM_T_CROSS,
        ROOM_T_FRACAVE,
+       ROOM_T_FIXED,
        ROOM_T_NORMAL,
 };
 
 /*!
- * @brief 鍵のかかったドアを配置する
- * @param y 配置したいフロアのY座標
- * @param x 配置したいフロアのX座標
- * @return なし
- */
-void place_locked_door(int y, int x)
-{
-       if (d_info[dungeon_type].flags1 & DF1_NO_DOORS)
-       {
-               place_floor_bold(y, x);
-       }
-       else
-       {
-               set_cave_feat(y, x, feat_locked_door_random((d_info[dungeon_type].flags1 & DF1_GLASS_DOOR) ? DOOR_GLASS_DOOR : DOOR_DOOR));
-               cave[y][x].info &= ~(CAVE_FLOOR);
-               delete_monster(y, x);
-       }
-}
-
-/*!
- * @brief 隠しドアを配置する
- * @param y 配置したいフロアのY座標
- * @param x 配置したいフロアのX座標
- * @param type DOOR_DEFAULT / DOOR_DOOR / DOOR_GLASS_DOOR / DOOR_CURTAIN のいずれか
- * @return なし
- */
-void place_secret_door(int y, int x, int type)
-{
-       if (d_info[dungeon_type].flags1 & DF1_NO_DOORS)
-       {
-               place_floor_bold(y, x);
-       }
-       else
-       {
-               cave_type *c_ptr = &cave[y][x];
-
-               if (type == DOOR_DEFAULT)
-               {
-                       type = ((d_info[dungeon_type].flags1 & DF1_CURTAIN) &&
-                               one_in_((d_info[dungeon_type].flags1 & DF1_NO_CAVE) ? 16 : 256)) ? DOOR_CURTAIN :
-                               ((d_info[dungeon_type].flags1 & DF1_GLASS_DOOR) ? DOOR_GLASS_DOOR : DOOR_DOOR);
-               }
-
-               /* Create secret door */
-               place_closed_door(y, x, type);
-
-               if (type != DOOR_CURTAIN)
-               {
-                       /* Hide by inner wall because this is used in rooms only */
-                       c_ptr->mimic = feat_wall_inner;
-
-                       /* Floor type terrain cannot hide a door */
-                       if (feat_supports_los(c_ptr->mimic) && !feat_supports_los(c_ptr->feat))
-                       {
-                               if (have_flag(f_info[c_ptr->mimic].flags, FF_MOVE) || have_flag(f_info[c_ptr->mimic].flags, FF_CAN_FLY))
-                               {
-                                       c_ptr->feat = one_in_(2) ? c_ptr->mimic : floor_type[randint0(100)];
-                               }
-                               c_ptr->mimic = 0;
-                       }
-               }
-
-               c_ptr->info &= ~(CAVE_FLOOR);
-               delete_monster(y, x);
-       }
-}
-
-/*!
  * @brief 1マスだけの部屋を作成し、上下左右いずれか一つに隠しドアを配置する。
  * @param y0 配置したい中心のY座標
  * @param x0 配置したい中心のX座標
@@ -189,9 +125,9 @@ void place_secret_door(int y, int x, int type)
  * Note - this should be used only on allocated regions
  * within another room.
  */
-void build_small_room(int x0, int y0)
+void build_small_room(POSITION x0, POSITION y0)
 {
-       int x, y;
+       POSITION x, y;
 
        for (y = y0 - 1; y <= y0 + 1; y++)
        {
@@ -231,13 +167,13 @@ void build_small_room(int x0, int y0)
  * @param y2 範囲の下端
  * @return なし
  */
-static void check_room_boundary(int x1, int y1, int x2, int y2)
+static void check_room_boundary(POSITION x1, POSITION y1, POSITION x2, POSITION y2)
 {
-       int count, x, y;
+       int count;
+       POSITION x, y;
        bool old_is_floor, new_is_floor;
 
 
-       /* Initialize */
        count = 0;
 
        old_is_floor = get_is_floor(x1 - 1, y1);
@@ -534,10 +470,10 @@ typedef struct fill_data_type fill_data_type;
 struct fill_data_type
 {
        /* area size */
-       int xmin;
-       int ymin;
-       int xmax;
-       int ymax;
+       POSITION xmin;
+       POSITION ymin;
+       POSITION xmax;
+       POSITION ymax;
 
        /* cutoffs */
        int c1;
@@ -545,9 +481,9 @@ struct fill_data_type
        int c3;
 
        /* features to fill with */
-       int feat1;
-       int feat2;
-       int feat3;
+       FEAT_IDX feat1;
+       FEAT_IDX feat2;
+       FEAT_IDX feat3;
 
        int info1;
        int info2;
@@ -562,7 +498,7 @@ static fill_data_type fill_data;
 
 /* Store routine for the fractal cave generator */
 /* this routine probably should be an inline function or a macro. */
-static void store_height(int x, int y, int val)
+static void store_height(POSITION x, POSITION y, int val)
 {
        /* if on boundary set val > cutoff so walls are not as square */
        if (((x == fill_data.xmin) || (y == fill_data.ymin) ||
@@ -629,9 +565,9 @@ static void store_height(int x, int y, int val)
  *    small values are good for smooth walls.
  *  size=length of the side of the square cave system.
  */
-void generate_hmap(int y0, int x0, int xsiz, int ysiz, int grd, int roug, int cutoff)
+void generate_hmap(POSITION y0, POSITION x0, POSITION xsiz, POSITION ysiz, int grd, int roug, int cutoff)
 {
-       int xhsize, yhsize, xsize, ysize, maxsize;
+       POSITION xhsize, yhsize, xsize, ysize, maxsize;
 
        /*
         * fixed point variables- these are stored as 256 x normal value
@@ -828,7 +764,7 @@ void generate_hmap(int y0, int x0, int xsiz, int ysiz, int grd, int roug, int cu
 }
 
 
-static bool hack_isnt_wall(int y, int x, int c1, int c2, int c3, int feat1, int feat2, int feat3, int info1, int info2, int info3)
+static bool hack_isnt_wall(POSITION y, POSITION x, int c1, int c2, int c3, int feat1, int feat2, int feat3, int info1, int info2, int info3)
 {
        /*
         * function used to convert from height-map back to the
@@ -986,9 +922,10 @@ static void cave_fill(POSITION y, POSITION x)
 }
 
 
-bool generate_fracave(int y0, int x0, int xsize, int ysize, int cutoff, bool light, bool room)
+bool generate_fracave(POSITION y0, POSITION x0, POSITION xsize, POSITION ysize, int cutoff, bool light, bool room)
 {
-       int x, y, i, xhsize, yhsize;
+       POSITION x, y, xhsize, yhsize;
+       int i;
 
        /* offsets to middle from corner */
        xhsize = xsize / 2;
@@ -1157,7 +1094,7 @@ bool generate_fracave(int y0, int x0, int xsize, int ysize, int cutoff, bool lig
        }
 
        /*
-        * XXX XXX XXX There is a slight problem when tunnels pierce the caves:
+        * There is a slight problem when tunnels pierce the caves:
         * Extra doors appear inside the system.  (Its not very noticeable though.)
         * This can be removed by "filling" from the outside in.  This allows a separation
         * from _outer_ with _inner_.  (Internal walls are  _outer_ instead.)
@@ -1211,10 +1148,11 @@ void build_cavern(void)
        }
 }
 
-bool generate_lake(int y0, int x0, int xsize, int ysize, int c1, int c2, int c3, int type)
+bool generate_lake(POSITION y0, POSITION x0, POSITION xsize, POSITION ysize, int c1, int c2, int c3, int type)
 {
-       int x, y, i, xhsize, yhsize;
-       int feat1, feat2, feat3;
+       POSITION x, y, xhsize, yhsize;
+       int i;
+       FEAT_IDX feat1, feat2, feat3;
 
        /* offsets to middle from corner */
        xhsize = xsize / 2;
@@ -1409,65 +1347,13 @@ void build_lake(int type)
 #endif /* ALLOW_CAVERNS_AND_LAKES */
 
 
-/*
- * Routine used by the random vault creators to add a door to a location
- * Note that range checking has to be done in the calling routine.
- *
- * The doors must be INSIDE the allocated region.
- */
-void add_door(int x, int y)
-{
-       /* Need to have a wall in the center square */
-       if (!is_outer_bold(y, x)) return;
-
-       /* look at:
-        *  x#x
-        *  .#.
-        *  x#x
-        *
-        *  where x=don't care
-        *  .=floor, #=wall
-        */
-
-       if (is_floor_bold(y-1,x) && is_floor_bold(y+1,x) &&
-           (is_outer_bold(y, x - 1) && is_outer_bold(y, x + 1)))
-       {
-               /* secret door */
-               place_secret_door(y, x, DOOR_DEFAULT);
-
-               /* set boundarys so don't get wide doors */
-               place_solid_bold(y, x - 1);
-               place_solid_bold(y, x + 1);
-       }
-
-
-       /* look at:
-        *  x#x
-        *  .#.
-        *  x#x
-        *
-        *  where x = don't care
-        *  .=floor, #=wall
-        */
-       if (is_outer_bold(y - 1, x) && is_outer_bold(y + 1, x) &&
-           is_floor_bold(y,x-1) && is_floor_bold(y,x+1))
-       {
-               /* secret door */
-               place_secret_door(y, x, DOOR_DEFAULT);
-
-               /* set boundarys so don't get wide doors */
-               place_solid_bold(y - 1, x);
-               place_solid_bold(y + 1, x);
-       }
-}
-
 
 /*
  * Routine that fills the empty areas of a room with treasure and monsters.
  */
-void fill_treasure(int x1, int x2, int y1, int y2, int difficulty)
+void fill_treasure(POSITION x1, POSITION x2, POSITION y1, POSITION y2, int difficulty)
 {
-       int x, y, cx, cy, size;
+       POSITION x, y, cx, cy, size;
        s32b value;
 
        /* center of room:*/
@@ -1604,14 +1490,14 @@ void fill_treasure(int x1, int x2, int y1, int y2, int difficulty)
  * The area inside the walls is not touched:
  * only granite is removed- normal walls stay
  */
-void build_room(int x1, int x2, int y1, int y2)
+void build_room(POSITION x1, POSITION x2, POSITION y1, POSITION y2)
 {
-       int x, y, i, xsize, ysize, temp;
+       POSITION x, y, xsize, ysize;
+       int i, temp;
 
        /* Check if rectangle has no width */
        if ((x1 == x2) || (y1 == y2)) return;
 
-       /* initialize */
        if (x1 > x2)
        {
                /* Swap boundaries if in wrong order */
@@ -1691,7 +1577,7 @@ void build_room(int x1, int x2, int y1, int y2)
  * is the randint0(3) below; it governs the relative density of
  * twists and turns in the labyrinth: smaller number, more twists.
  */
-void r_visit(int y1, int x1, int y2, int x2, int node, int dir, int *visited)
+void r_visit(POSITION y1, POSITION x1, POSITION y2, POSITION x2, int node, DIRECTION dir, int *visited)
 {
        int i, j, m, n, temp, x, y, adj[4];
 
@@ -1775,10 +1661,10 @@ void r_visit(int y1, int x1, int y2, int x2, int node, int dir, int *visited)
 }
 
 
-void build_maze_vault(int x0, int y0, int xsize, int ysize, bool is_vault)
+void build_maze_vault(POSITION x0, POSITION y0, POSITION xsize, POSITION ysize, bool is_vault)
 {
-       int y, x, dy, dx;
-       int y1, x1, y2, x2;
+       POSITION y, x, dy, dx;
+       POSITION y1, x1, y2, x2;
        int m, n, num_vertices, *visited;
        bool light;
        cave_type *c_ptr;
@@ -1846,10 +1732,10 @@ void build_maze_vault(int x0, int y0, int xsize, int ysize, bool is_vault)
  * The power variable is a measure of how well defended a region is.
  * This alters the possible choices.
  */
-void build_recursive_room(int x1, int y1, int x2, int y2, int power)
+void build_recursive_room(POSITION x1, POSITION y1, POSITION x2, POSITION y2, int power)
 {
-       int xsize, ysize;
-       int x, y;
+       POSITION xsize, ysize;
+       POSITION x, y;
        int choice;
 
        /* Temp variables */
@@ -2050,7 +1936,7 @@ void build_recursive_room(int x1, int y1, int x2, int y2, int power)
  * Note: no range checking is done so must be inside dungeon
  * This routine also stomps on doors
  */
-void add_outer_wall(int x, int y, int light, int x1, int y1, int x2, int y2)
+void add_outer_wall(POSITION x, POSITION y, int light, POSITION x1, POSITION y1, POSITION x2, POSITION y2)
 {
        cave_type *c_ptr;
        feature_type *f_ptr;
@@ -2102,9 +1988,9 @@ void add_outer_wall(int x, int y, int light, int x1, int y1, int x2, int y2)
  * Hacked distance formula - gives the 'wrong' answer.
  * Used to build crypts
  */
-int dist2(int x1, int y1, int x2, int y2, int h1, int h2, int h3, int h4)
+POSITION dist2(POSITION x1, POSITION y1, POSITION x2, POSITION y2, POSITION h1, POSITION h2, POSITION h3, POSITION h4)
 {
-       int dx, dy;
+       POSITION dx, dy;
        dx = abs(x2 - x1);
        dy = abs(y2 - y1);
 
@@ -2127,9 +2013,9 @@ int dist2(int x1, int y1, int x2, int y2, int h1, int h2, int h3, int h4)
 
 
 /* Create a new floor room with optional light */
-void generate_room_floor(int y1, int x1, int y2, int x2, int light)
+void generate_room_floor(POSITION y1, POSITION x1, POSITION y2, POSITION x2, int light)
 {
-       int y, x;
+       POSITION y, x;
        
        cave_type *c_ptr;
 
@@ -2146,9 +2032,9 @@ void generate_room_floor(int y1, int x1, int y2, int x2, int light)
        }
 }
 
-void generate_fill_perm_bold(int y1, int x1, int y2, int x2)
+void generate_fill_perm_bold(POSITION y1, POSITION x1, POSITION y2, POSITION x2)
 {
-       int y, x;
+       POSITION y, x;
 
        for (y = y1; y <= y2; y++)
        {
@@ -2167,7 +2053,7 @@ void generate_fill_perm_bold(int y1, int x1, int y2, int x2)
  * @note that we restrict the number of "crowded" rooms to reduce the chance of overflowing the monster list during level creation.
  * @return 部屋の精製に成功した場合 TRUE を返す。
  */
-static bool room_build(int typ)
+static bool room_build(EFFECT_ID typ)
 {
        /* Build a room */
        switch (typ)
@@ -2189,6 +2075,7 @@ static bool room_build(int typ)
        case ROOM_T_TRAP:          return build_type14();
        case ROOM_T_GLASS:         return build_type15();
        case ROOM_T_ARCADE:        return build_type16();
+       case ROOM_T_FIXED:         return build_type17();
        }
 
        /* Paranoia */