OSDN Git Service

[Refactor] #40572 *Genocide* global variable dun_data
authorHourier <hourier@users.sourceforge.jp>
Wed, 5 Aug 2020 10:20:24 +0000 (19:20 +0900)
committerHourier <hourier@users.sourceforge.jp>
Wed, 5 Aug 2020 10:20:24 +0000 (19:20 +0900)
29 files changed:
Hengband/Hengband/Hengband.vcxproj
Hengband/Hengband/Hengband.vcxproj.filters
src/floor/cave-generator.c
src/floor/floor-streams.c
src/floor/floor-streams.h
src/floor/tunnel-generator.c
src/floor/tunnel-generator.h
src/grid/feature-generator.c
src/grid/feature-generator.h
src/room/room-generator.c
src/room/room-generator.h
src/room/rooms-city.c
src/room/rooms-city.h
src/room/rooms-fractal.c
src/room/rooms-fractal.h
src/room/rooms-normal.c
src/room/rooms-normal.h
src/room/rooms-pit-nest.c
src/room/rooms-pit-nest.h
src/room/rooms-special.c
src/room/rooms-special.h
src/room/rooms-trap.c
src/room/rooms-trap.h
src/room/rooms-vault.c
src/room/rooms-vault.h
src/room/space-finder.c
src/room/space-finder.h
src/system/dungeon-data-definition.c [deleted file]
src/system/dungeon-data-definition.h

index ca53233..700de08 100644 (file)
     <ClCompile Include="..\..\src\store\purchase-order.c" />\r
     <ClCompile Include="..\..\src\store\sell-order.c" />\r
     <ClCompile Include="..\..\src\store\service-checker.c" />\r
-    <ClCompile Include="..\..\src\system\dungeon-data-definition.c" />\r
     <ClCompile Include="..\..\src\target\grid-selector.c" />\r
     <ClCompile Include="..\..\src\target\target-describer.c" />\r
     <ClCompile Include="..\..\src\target\target-getter.c" />\r
index 5911789..0fdb7e7 100644 (file)
     <ClCompile Include="..\..\src\room\room-generator.c">
       <Filter>room</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\src\system\dungeon-data-definition.c">
-      <Filter>system</Filter>
-    </ClCompile>
     <ClCompile Include="..\..\src\room\treasure-deployment.c">
       <Filter>room</Filter>
     </ClCompile>
index a96a629..5142a12 100644 (file)
  */
 bool cave_gen(player_type *player_ptr, concptr *why)
 {
-    dun_data_type dun_body;
     floor_type *floor_ptr = player_ptr->current_floor_ptr;
     dungeon_type *dungeon_ptr = &d_info[floor_ptr->dungeon_idx];
     floor_ptr->lite_n = 0;
     floor_ptr->mon_lite_n = 0;
     floor_ptr->redraw_n = 0;
     floor_ptr->view_n = 0;
-    dun_data = &dun_body;
-    dun_data->destroyed = FALSE;
-    dun_data->empty_level = FALSE;
-    dun_data->cavern = FALSE;
-    dun_data->laketype = 0;
+    dun_data_type tmp_dd;
+    dun_data_type *dd_ptr = &tmp_dd;
+    dd_ptr->destroyed = FALSE;
+    dd_ptr->empty_level = FALSE;
+    dd_ptr->cavern = FALSE;
+    dd_ptr->laketype = 0;
     set_floor_and_wall(floor_ptr->dungeon_idx);
     get_mon_num_prep(player_ptr, get_monster_hook(player_ptr), NULL);
 
     dt_type tmp_dt;
     dt_type *dt_ptr = initialize_dt_type(&tmp_dt);
 
-    dun_data->row_rooms = floor_ptr->height / BLOCK_HGT;
-    dun_data->col_rooms = floor_ptr->width / BLOCK_WID;
-    for (POSITION y = 0; y < dun_data->row_rooms; y++)
-        for (POSITION x = 0; x < dun_data->col_rooms; x++)
-            dun_data->room_map[y][x] = FALSE;
+    dd_ptr->row_rooms = floor_ptr->height / BLOCK_HGT;
+    dd_ptr->col_rooms = floor_ptr->width / BLOCK_WID;
+    for (POSITION y = 0; y < dd_ptr->row_rooms; y++)
+        for (POSITION x = 0; x < dd_ptr->col_rooms; x++)
+            dd_ptr->room_map[y][x] = FALSE;
 
-    dun_data->cent_n = 0;
+    dd_ptr->cent_n = 0;
     if (ironman_empty_levels || ((dungeon_ptr->flags1 & DF1_ARENA) && (empty_levels && one_in_(EMPTY_LEVEL)))) {
-        dun_data->empty_level = TRUE;
+        dd_ptr->empty_level = TRUE;
         msg_print_wizard(player_ptr, CHEAT_DUNGEON, _("アリーナレベルを生成。", "Arena level."));
     }
 
-    if (dun_data->empty_level) {
+    if (dd_ptr->empty_level) {
         for (POSITION y = 0; y < floor_ptr->height; y++)
             for (POSITION x = 0; x < floor_ptr->width; x++)
                 place_bold(player_ptr, y, x, GB_FLOOR);
@@ -86,7 +86,7 @@ bool cave_gen(player_type *player_ptr, concptr *why)
                 place_bold(player_ptr, y, x, GB_EXTRA);
     }
 
-    gen_caverns_and_lakes(dungeon_ptr, player_ptr);
+    gen_caverns_and_lakes(player_ptr, dungeon_ptr, dd_ptr);
     if (dungeon_ptr->flags1 & DF1_MAZE) {
         build_maze_vault(player_ptr, floor_ptr->width / 2 - 1, floor_ptr->height / 2 - 1, floor_ptr->width - 4, floor_ptr->height - 4, FALSE);
         if (!alloc_stairs(player_ptr, feat_down_stair, rand_range(2, 3), 3)) {
@@ -100,7 +100,7 @@ bool cave_gen(player_type *player_ptr, concptr *why)
         }
     } else {
         int tunnel_fail_count = 0;
-        if (!generate_rooms(player_ptr)) {
+        if (!generate_rooms(player_ptr, dd_ptr)) {
             *why = _("部屋群の生成に失敗", "Failed to generate rooms");
             return FALSE;
         }
@@ -109,33 +109,33 @@ bool cave_gen(player_type *player_ptr, concptr *why)
             while (one_in_(DUN_MOS_DEN))
                 place_trees(player_ptr, randint1(floor_ptr->width - 2), randint1(floor_ptr->height - 2));
 
-        if (dun_data->destroyed)
+        if (dd_ptr->destroyed)
             destroy_level(player_ptr);
 
         if (has_river_flag(dungeon_ptr) && one_in_(3) && (randint1(floor_ptr->dun_level) > 5))
-            add_river(floor_ptr);
+            add_river(floor_ptr, dd_ptr);
 
-        for (int i = 0; i < dun_data->cent_n; i++) {
+        for (int i = 0; i < dd_ptr->cent_n; i++) {
             POSITION ty, tx;
             int pick = rand_range(0, i);
-            ty = dun_data->cent[i].y;
-            tx = dun_data->cent[i].x;
-            dun_data->cent[i].y = dun_data->cent[pick].y;
-            dun_data->cent[i].x = dun_data->cent[pick].x;
-            dun_data->cent[pick].y = ty;
-            dun_data->cent[pick].x = tx;
+            ty = dd_ptr->cent[i].y;
+            tx = dd_ptr->cent[i].x;
+            dd_ptr->cent[i].y = dd_ptr->cent[pick].y;
+            dd_ptr->cent[i].x = dd_ptr->cent[pick].x;
+            dd_ptr->cent[pick].y = ty;
+            dd_ptr->cent[pick].x = tx;
         }
 
-        dun_data->door_n = 0;
-        POSITION y = dun_data->cent[dun_data->cent_n - 1].y;
-        POSITION x = dun_data->cent[dun_data->cent_n - 1].x;
+        dd_ptr->door_n = 0;
+        POSITION y = dd_ptr->cent[dd_ptr->cent_n - 1].y;
+        POSITION x = dd_ptr->cent[dd_ptr->cent_n - 1].x;
 
-        for (int i = 0; i < dun_data->cent_n; i++) {
-            dun_data->tunn_n = 0;
-            dun_data->wall_n = 0;
+        for (int i = 0; i < dd_ptr->cent_n; i++) {
+            dd_ptr->tunn_n = 0;
+            dd_ptr->wall_n = 0;
             if (randint1(floor_ptr->dun_level) > dungeon_ptr->tunnel_percent)
-                (void)build_tunnel2(player_ptr, dun_data->cent[i].x, dun_data->cent[i].y, x, y, 2, 2);
-            else if (!build_tunnel(player_ptr, dt_ptr, dun_data->cent[i].y, dun_data->cent[i].x, y, x))
+                (void)build_tunnel2(player_ptr, dd_ptr, dd_ptr->cent[i].x, dd_ptr->cent[i].y, x, y, 2, 2);
+            else if (!build_tunnel(player_ptr, dd_ptr, dt_ptr, dd_ptr->cent[i].y, dd_ptr->cent[i].x, y, x))
                 tunnel_fail_count++;
 
             if (tunnel_fail_count >= 2) {
@@ -143,11 +143,11 @@ bool cave_gen(player_type *player_ptr, concptr *why)
                 return FALSE;
             }
 
-            for (int j = 0; j < dun_data->tunn_n; j++) {
+            for (int j = 0; j < dd_ptr->tunn_n; j++) {
                 grid_type *g_ptr;
                 feature_type *f_ptr;
-                y = dun_data->tunn[j].y;
-                x = dun_data->tunn[j].x;
+                y = dd_ptr->tunn[j].y;
+                x = dd_ptr->tunn[j].x;
                 g_ptr = &floor_ptr->grid_array[y][x];
                 f_ptr = &f_info[g_ptr->feat];
 
@@ -157,10 +157,10 @@ bool cave_gen(player_type *player_ptr, concptr *why)
                 }
             }
 
-            for (int j = 0; j < dun_data->wall_n; j++) {
+            for (int j = 0; j < dd_ptr->wall_n; j++) {
                 grid_type *g_ptr;
-                y = dun_data->wall[j].y;
-                x = dun_data->wall[j].x;
+                y = dd_ptr->wall[j].y;
+                x = dd_ptr->wall[j].x;
                 g_ptr = &floor_ptr->grid_array[y][x];
                 g_ptr->mimic = 0;
                 place_grid(player_ptr, g_ptr, GB_FLOOR);
@@ -168,13 +168,13 @@ bool cave_gen(player_type *player_ptr, concptr *why)
                     place_random_door(player_ptr, y, x, TRUE);
             }
 
-            y = dun_data->cent[i].y;
-            x = dun_data->cent[i].x;
+            y = dd_ptr->cent[i].y;
+            x = dd_ptr->cent[i].x;
         }
 
-        for (int i = 0; i < dun_data->door_n; i++) {
-            y = dun_data->door[i].y;
-            x = dun_data->door[i].x;
+        for (int i = 0; i < dd_ptr->door_n; i++) {
+            y = dd_ptr->door[i].y;
+            x = dd_ptr->door[i].x;
             try_door(player_ptr, dt_ptr, y, x - 1);
             try_door(player_ptr, dt_ptr, y, x + 1);
             try_door(player_ptr, dt_ptr, y - 1, x);
@@ -192,7 +192,7 @@ bool cave_gen(player_type *player_ptr, concptr *why)
         }
     }
 
-    if (!dun_data->laketype) {
+    if (!dd_ptr->laketype) {
         if (dungeon_ptr->stream2)
             for (int i = 0; i < DUN_STR_QUA; i++)
                 build_streamer(player_ptr, dungeon_ptr->stream2, DUN_STR_QC);
@@ -263,7 +263,7 @@ bool cave_gen(player_type *player_ptr, concptr *why)
         return FALSE;
     }
 
-    bool is_empty_or_dark = dun_data->empty_level;
+    bool is_empty_or_dark = dd_ptr->empty_level;
     is_empty_or_dark &= !one_in_(DARK_EMPTY) || (randint1(100) > floor_ptr->dun_level);
     is_empty_or_dark &= (dungeon_ptr->flags1 & DF1_DARKNESS) == 0;
     if (!is_empty_or_dark)
index 3e7247d..f945ab7 100644 (file)
@@ -159,7 +159,7 @@ static void recursive_river(floor_type *floor_ptr, POSITION x1, POSITION y1, POS
  * @param feat2 境界部地形ID
  * @return なし
  */
-void add_river(floor_type *floor_ptr)
+void add_river(floor_type *floor_ptr, dun_data_type *dd_ptr)
 {
     dungeon_type *dungeon_ptr;
     POSITION y2, x2;
@@ -208,8 +208,8 @@ void add_river(floor_type *floor_ptr)
         feature_type *f_ptr = &f_info[feat1];
 
         /* Only add river if matches lake type or if have no lake at all */
-        if (!(((dun_data->laketype == LAKE_T_LAVA) && have_flag(f_ptr->flags, FF_LAVA)) || ((dun_data->laketype == LAKE_T_WATER) && have_flag(f_ptr->flags, FF_WATER))
-                || !dun_data->laketype)) {
+        if (!(((dd_ptr->laketype == LAKE_T_LAVA) && have_flag(f_ptr->flags, FF_LAVA)) || ((dd_ptr->laketype == LAKE_T_WATER) && have_flag(f_ptr->flags, FF_WATER))
+                || !dd_ptr->laketype)) {
             return;
         }
     }
@@ -250,10 +250,10 @@ void add_river(floor_type *floor_ptr)
     recursive_river(floor_ptr, x1, y1, x2, y2, feat1, feat2, wid);
 
     /* Hack - Save the location as a "room" */
-    if (dun_data->cent_n < CENT_MAX) {
-        dun_data->cent[dun_data->cent_n].y = y2;
-        dun_data->cent[dun_data->cent_n].x = x2;
-        dun_data->cent_n++;
+    if (dd_ptr->cent_n < CENT_MAX) {
+        dd_ptr->cent[dd_ptr->cent_n].y = y2;
+        dd_ptr->cent[dd_ptr->cent_n].x = x2;
+        dd_ptr->cent_n++;
     }
 }
 
index 5bccb18..1ada929 100644 (file)
@@ -2,7 +2,8 @@
 
 #include "system/angband.h"
 
-void add_river(floor_type *floor_ptr);
+typedef struct dun_data_type dun_data_type;
+void add_river(floor_type *floor_ptr, dun_data_type *dd_ptr);
 void build_streamer(player_type *player_ptr, FEAT_IDX feat, int chance);
 void place_trees(player_type *player_ptr, POSITION x, POSITION y);
 void destroy_level(player_type *player_ptr);
index 8a39245..bafb9bf 100644 (file)
@@ -77,7 +77,7 @@ static void correct_dir(POSITION *rdir, POSITION *cdir, POSITION y1, POSITION x1
  *   outer -- outer room walls\n
  *   solid -- solid room walls\n
  */
-bool build_tunnel(player_type *player_ptr, dt_type *dt_ptr, POSITION row1, POSITION col1, POSITION row2, POSITION col2)
+bool build_tunnel(player_type *player_ptr, dun_data_type *dd_ptr, dt_type *dt_ptr, POSITION row1, POSITION col1, POSITION row2, POSITION col2)
 {
     POSITION tmp_row, tmp_col;
     POSITION row_dir, col_dir;
@@ -122,12 +122,12 @@ bool build_tunnel(player_type *player_ptr, dt_type *dt_ptr, POSITION row1, POSIT
 
             row1 = tmp_row;
             col1 = tmp_col;
-            if (dun_data->wall_n >= WALL_MAX)
+            if (dd_ptr->wall_n >= WALL_MAX)
                 return FALSE;
 
-            dun_data->wall[dun_data->wall_n].y = row1;
-            dun_data->wall[dun_data->wall_n].x = col1;
-            dun_data->wall_n++;
+            dd_ptr->wall[dd_ptr->wall_n].y = row1;
+            dd_ptr->wall[dd_ptr->wall_n].x = col1;
+            dd_ptr->wall_n++;
             for (y = row1 - 1; y <= row1 + 1; y++)
                 for (x = col1 - 1; x <= col1 + 1; x++)
                     if (is_outer_bold(floor_ptr, y, x))
@@ -139,23 +139,23 @@ bool build_tunnel(player_type *player_ptr, dt_type *dt_ptr, POSITION row1, POSIT
         } else if (is_extra_grid(g_ptr) || is_inner_grid(g_ptr) || is_solid_grid(g_ptr)) {
             row1 = tmp_row;
             col1 = tmp_col;
-            if (dun_data->tunn_n >= TUNN_MAX)
+            if (dd_ptr->tunn_n >= TUNN_MAX)
                 return FALSE;
 
-            dun_data->tunn[dun_data->tunn_n].y = row1;
-            dun_data->tunn[dun_data->tunn_n].x = col1;
-            dun_data->tunn_n++;
+            dd_ptr->tunn[dd_ptr->tunn_n].y = row1;
+            dd_ptr->tunn[dd_ptr->tunn_n].x = col1;
+            dd_ptr->tunn_n++;
             door_flag = FALSE;
         } else {
             row1 = tmp_row;
             col1 = tmp_col;
             if (!door_flag) {
-                if (dun_data->door_n >= DOOR_MAX)
+                if (dd_ptr->door_n >= DOOR_MAX)
                     return FALSE;
 
-                dun_data->door[dun_data->door_n].y = row1;
-                dun_data->door[dun_data->door_n].x = col1;
-                dun_data->door_n++;
+                dd_ptr->door[dd_ptr->door_n].y = row1;
+                dd_ptr->door[dd_ptr->door_n].x = col1;
+                dd_ptr->door_n++;
                 door_flag = TRUE;
             }
 
@@ -196,7 +196,7 @@ bool build_tunnel(player_type *player_ptr, dt_type *dt_ptr, POSITION row1, POSIT
  * routine.\n
  * @todo 特に詳細な処理の意味を調査すべし
  */
-static bool set_tunnel(player_type *player_ptr, POSITION *x, POSITION *y, bool affectwall)
+static bool set_tunnel(player_type *player_ptr, dun_data_type *dd_ptr, POSITION *x, POSITION *y, bool affectwall)
 {
     floor_type *floor_ptr = player_ptr->current_floor_ptr;
     grid_type *g_ptr = &floor_ptr->grid_array[*y][*x];
@@ -204,12 +204,12 @@ static bool set_tunnel(player_type *player_ptr, POSITION *x, POSITION *y, bool a
         return TRUE;
 
     if (is_extra_bold(floor_ptr, *y, *x)) {
-        if (dun_data->tunn_n >= TUNN_MAX)
+        if (dd_ptr->tunn_n >= TUNN_MAX)
             return FALSE;
 
-        dun_data->tunn[dun_data->tunn_n].y = *y;
-        dun_data->tunn[dun_data->tunn_n].x = *x;
-        dun_data->tunn_n++;
+        dd_ptr->tunn[dd_ptr->tunn_n].y = *y;
+        dd_ptr->tunn[dd_ptr->tunn_n].x = *x;
+        dd_ptr->tunn_n++;
         return TRUE;
     }
 
@@ -217,12 +217,12 @@ static bool set_tunnel(player_type *player_ptr, POSITION *x, POSITION *y, bool a
         return TRUE;
 
     if (is_outer_grid(g_ptr) && affectwall) {
-        if (dun_data->wall_n >= WALL_MAX)
+        if (dd_ptr->wall_n >= WALL_MAX)
             return FALSE;
 
-        dun_data->wall[dun_data->wall_n].y = *y;
-        dun_data->wall[dun_data->wall_n].x = *x;
-        dun_data->wall_n++;
+        dd_ptr->wall[dd_ptr->wall_n].y = *y;
+        dd_ptr->wall[dd_ptr->wall_n].x = *x;
+        dd_ptr->wall_n++;
         for (int j = *y - 1; j <= *y + 1; j++)
             for (int i = *x - 1; i <= *x + 1; i++)
                 if (is_outer_bold(floor_ptr, j, i))
@@ -272,23 +272,23 @@ static bool set_tunnel(player_type *player_ptr, POSITION *x, POSITION *y, bool a
  * Note that this routine is only called on "even" squares - so it gives
  * a natural checkerboard pattern.
  */
-static void create_cata_tunnel(player_type *player_ptr, POSITION x, POSITION y)
+static void create_cata_tunnel(player_type *player_ptr, dun_data_type *dd_ptr, POSITION x, POSITION y)
 {
     POSITION x1 = x - 1;
     POSITION y1 = y;
-    set_tunnel(player_ptr, &x1, &y1, FALSE);
+    set_tunnel(player_ptr, dd_ptr, &x1, &y1, FALSE);
 
     x1 = x + 1;
     y1 = y;
-    set_tunnel(player_ptr, &x1, &y1, FALSE);
+    set_tunnel(player_ptr, dd_ptr, &x1, &y1, FALSE);
 
     x1 = x;
     y1 = y - 1;
-    set_tunnel(player_ptr, &x1, &y1, FALSE);
+    set_tunnel(player_ptr, dd_ptr, &x1, &y1, FALSE);
 
     x1 = x;
     y1 = y + 1;
-    set_tunnel(player_ptr, &x1, &y1, FALSE);
+    set_tunnel(player_ptr, dd_ptr, &x1, &y1, FALSE);
 }
 
 /*!
@@ -314,7 +314,8 @@ static void create_cata_tunnel(player_type *player_ptr, POSITION x, POSITION y)
  * This, when used with longer line segments gives the "catacomb-like" tunnels seen near\n
  * the surface.\n
  */
-static void short_seg_hack(player_type *player_ptr, const POSITION x1, const POSITION y1, const POSITION x2, const POSITION y2, int type, int count, bool *fail)
+static void short_seg_hack(player_type *player_ptr, dun_data_type *dd_ptr, const POSITION x1, const POSITION y1, const POSITION x2, const POSITION y2,
+    int type, int count, bool *fail)
 {
     if (!(*fail))
         return;
@@ -326,14 +327,14 @@ static void short_seg_hack(player_type *player_ptr, const POSITION x1, const POS
         for (int i = 0; i <= length; i++) {
             x = x1 + i * (x2 - x1) / length;
             y = y1 + i * (y2 - y1) / length;
-            if (!set_tunnel(player_ptr, &x, &y, TRUE)) {
+            if (!set_tunnel(player_ptr, dd_ptr, &x, &y, TRUE)) {
                 if (count > 50) {
                     *fail = FALSE;
                     return;
                 }
 
-                short_seg_hack(player_ptr, x, y, x1 + (i - 1) * (x2 - x1) / length, y1 + (i - 1) * (y2 - y1) / length, 1, count, fail);
-                short_seg_hack(player_ptr, x, y, x1 + (i + 1) * (x2 - x1) / length, y1 + (i + 1) * (y2 - y1) / length, 1, count, fail);
+                short_seg_hack(player_ptr, dd_ptr, x, y, x1 + (i - 1) * (x2 - x1) / length, y1 + (i - 1) * (y2 - y1) / length, 1, count, fail);
+                short_seg_hack(player_ptr, dd_ptr, x, y, x1 + (i + 1) * (x2 - x1) / length, y1 + (i + 1) * (y2 - y1) / length, 1, count, fail);
             }
         }
 
@@ -347,25 +348,25 @@ static void short_seg_hack(player_type *player_ptr, const POSITION x1, const POS
         for (int i = x1; i <= x2; i++) {
             x = i;
             y = y1;
-            if (!set_tunnel(player_ptr, &x, &y, TRUE)) {
-                short_seg_hack(player_ptr, x, y, i - 1, y1, 1, count, fail);
-                short_seg_hack(player_ptr, x, y, i + 1, y1, 1, count, fail);
+            if (!set_tunnel(player_ptr, dd_ptr, &x, &y, TRUE)) {
+                short_seg_hack(player_ptr, dd_ptr, x, y, i - 1, y1, 1, count, fail);
+                short_seg_hack(player_ptr, dd_ptr, x, y, i + 1, y1, 1, count, fail);
             }
 
             if ((type == 3) && ((x + y) % 2))
-                create_cata_tunnel(player_ptr, i, y1);
+                create_cata_tunnel(player_ptr, dd_ptr, i, y1);
         }
     } else {
         for (int i = x2; i <= x1; i++) {
             x = i;
             y = y1;
-            if (!set_tunnel(player_ptr, &x, &y, TRUE)) {
-                short_seg_hack(player_ptr, x, y, i - 1, y1, 1, count, fail);
-                short_seg_hack(player_ptr, x, y, i + 1, y1, 1, count, fail);
+            if (!set_tunnel(player_ptr, dd_ptr, &x, &y, TRUE)) {
+                short_seg_hack(player_ptr, dd_ptr, x, y, i - 1, y1, 1, count, fail);
+                short_seg_hack(player_ptr, dd_ptr, x, y, i + 1, y1, 1, count, fail);
             }
 
             if ((type == 3) && ((x + y) % 2))
-                create_cata_tunnel(player_ptr, i, y1);
+                create_cata_tunnel(player_ptr, dd_ptr, i, y1);
         }
     }
 
@@ -373,25 +374,25 @@ static void short_seg_hack(player_type *player_ptr, const POSITION x1, const POS
         for (int i = y1; i <= y2; i++) {
             x = x2;
             y = i;
-            if (!set_tunnel(player_ptr, &x, &y, TRUE)) {
-                short_seg_hack(player_ptr, x, y, x2, i - 1, 1, count, fail);
-                short_seg_hack(player_ptr, x, y, x2, i + 1, 1, count, fail);
+            if (!set_tunnel(player_ptr, dd_ptr, &x, &y, TRUE)) {
+                short_seg_hack(player_ptr, dd_ptr, x, y, x2, i - 1, 1, count, fail);
+                short_seg_hack(player_ptr, dd_ptr, x, y, x2, i + 1, 1, count, fail);
             }
 
             if ((type == 3) && ((x + y) % 2))
-                create_cata_tunnel(player_ptr, x2, i);
+                create_cata_tunnel(player_ptr, dd_ptr, x2, i);
         }
     } else {
         for (int i = y2; i <= y1; i++) {
             x = x2;
             y = i;
-            if (!set_tunnel(player_ptr, &x, &y, TRUE)) {
-                short_seg_hack(player_ptr, x, y, x2, i - 1, 1, count, fail);
-                short_seg_hack(player_ptr, x, y, x2, i + 1, 1, count, fail);
+            if (!set_tunnel(player_ptr, dd_ptr, &x, &y, TRUE)) {
+                short_seg_hack(player_ptr, dd_ptr, x, y, x2, i - 1, 1, count, fail);
+                short_seg_hack(player_ptr, dd_ptr, x, y, x2, i + 1, 1, count, fail);
             }
 
             if ((type == 3) && ((x + y) % 2))
-                create_cata_tunnel(player_ptr, x2, i);
+                create_cata_tunnel(player_ptr, dd_ptr, x2, i);
         }
     }
 }
@@ -410,7 +411,7 @@ static void short_seg_hack(player_type *player_ptr, const POSITION x1, const POS
  * Note it is VERY important that the "stop if hit another passage" logic\n
  * stays as is.  Without this the dungeon turns into Swiss Cheese...\n
  */
-bool build_tunnel2(player_type *player_ptr, POSITION x1, POSITION y1, POSITION x2, POSITION y2, int type, int cutoff)
+bool build_tunnel2(player_type *player_ptr, dun_data_type *dd_ptr, POSITION x1, POSITION y1, POSITION x2, POSITION y2, int type, int cutoff)
 {
     POSITION x3, y3, dx, dy;
     POSITION changex, changey;
@@ -421,7 +422,7 @@ bool build_tunnel2(player_type *player_ptr, POSITION x1, POSITION y1, POSITION x
     floor_type *floor_ptr = player_ptr->current_floor_ptr;
     if (length <= cutoff) {
         retval = TRUE;
-        short_seg_hack(player_ptr, x1, y1, x2, y2, type, 0, &retval);
+        short_seg_hack(player_ptr, dd_ptr, x1, y1, x2, y2, type, 0, &retval);
         return TRUE;
     }
 
@@ -463,17 +464,17 @@ bool build_tunnel2(player_type *player_ptr, POSITION x1, POSITION y1, POSITION x
     }
 
     if (is_floor_grid(g_ptr)) {
-        if (build_tunnel2(player_ptr, x1, y1, x3, y3, type, cutoff)) {
+        if (build_tunnel2(player_ptr, dd_ptr, x1, y1, x3, y3, type, cutoff)) {
             if ((floor_ptr->grid_array[y3][x3].info & CAVE_ROOM) || (randint1(100) > 95)) {
-                retval = build_tunnel2(player_ptr, x3, y3, x2, y2, type, cutoff);
+                retval = build_tunnel2(player_ptr, dd_ptr, x3, y3, x2, y2, type, cutoff);
             } else {
                 retval = FALSE;
-                if (dun_data->door_n >= DOOR_MAX)
+                if (dd_ptr->door_n >= DOOR_MAX)
                     return FALSE;
 
-                dun_data->door[dun_data->door_n].y = y3;
-                dun_data->door[dun_data->door_n].x = x3;
-                dun_data->door_n++;
+                dd_ptr->door[dd_ptr->door_n].y = y3;
+                dd_ptr->door[dd_ptr->door_n].x = x3;
+                dd_ptr->door_n++;
             }
 
             firstsuccede = TRUE;
@@ -482,8 +483,8 @@ bool build_tunnel2(player_type *player_ptr, POSITION x1, POSITION y1, POSITION x
             firstsuccede = FALSE;
         }
     } else {
-        if (build_tunnel2(player_ptr, x1, y1, x3, y3, type, cutoff)) {
-            retval = build_tunnel2(player_ptr, x3, y3, x2, y2, type, cutoff);
+        if (build_tunnel2(player_ptr, dd_ptr, x1, y1, x3, y3, type, cutoff)) {
+            retval = build_tunnel2(player_ptr, dd_ptr, x3, y3, x2, y2, type, cutoff);
             firstsuccede = TRUE;
         } else {
             retval = FALSE;
@@ -492,7 +493,7 @@ bool build_tunnel2(player_type *player_ptr, POSITION x1, POSITION y1, POSITION x
     }
 
     if (firstsuccede)
-        set_tunnel(player_ptr, &x3, &y3, TRUE);
+        set_tunnel(player_ptr, dd_ptr, &x3, &y3, TRUE);
 
     return retval;
 }
index 10c8076..74dcc7d 100644 (file)
@@ -2,6 +2,7 @@
 
 #include "system/angband.h"
 
+typedef struct dun_data_type dun_data_type;
 typedef struct dt_type dt_type;
-bool build_tunnel(player_type *player_ptr, dt_type *dt_ptr, POSITION row1, POSITION col1, POSITION row2, POSITION col2);
-bool build_tunnel2(player_type *player_ptr, POSITION x1, POSITION y1, POSITION x2, POSITION y2, int type, int cutoff);
+bool build_tunnel(player_type *player_ptr, dun_data_type *dd_ptr, dt_type *dt_ptr, POSITION row1, POSITION col1, POSITION row2, POSITION col2);
+bool build_tunnel2(player_type *player_ptr, dun_data_type *dd_ptr, POSITION x1, POSITION y1, POSITION x2, POSITION y2, int type, int cutoff);
index c6ccb9a..bf83f1d 100644 (file)
  * @details There were moved from cave_gen().
  * @return なし
  */
-void gen_caverns_and_lakes(dungeon_type *dungeon_ptr, player_type *owner_ptr)
+void gen_caverns_and_lakes(player_type *owner_ptr, dungeon_type *dungeon_ptr, dun_data_type *dd_ptr)
 {
     floor_type *floor_ptr = owner_ptr->current_floor_ptr;
     if ((floor_ptr->dun_level > 30) && one_in_(DUN_DEST * 2) && small_levels && (dungeon_ptr->flags1 & DF1_DESTROY)) {
-        dun_data->destroyed = TRUE;
+        dd_ptr->destroyed = TRUE;
         build_lake(owner_ptr, one_in_(2) ? LAKE_T_CAVE : LAKE_T_EARTH_VAULT);
     }
 
-    if (one_in_(LAKE_LEVEL) && !dun_data->empty_level && !dun_data->destroyed && (dungeon_ptr->flags1 & DF1_LAKE_MASK)) {
+    if (one_in_(LAKE_LEVEL) && !dd_ptr->empty_level && !dd_ptr->destroyed && (dungeon_ptr->flags1 & DF1_LAKE_MASK)) {
         int count = 0;
         if (dungeon_ptr->flags1 & DF1_LAKE_WATER)
             count += 3;
@@ -43,55 +43,55 @@ void gen_caverns_and_lakes(dungeon_type *dungeon_ptr, player_type *owner_ptr)
 
         if (dungeon_ptr->flags1 & DF1_LAKE_LAVA) {
             if ((floor_ptr->dun_level > 80) && (randint0(count) < 2))
-                dun_data->laketype = LAKE_T_LAVA;
+                dd_ptr->laketype = LAKE_T_LAVA;
 
             count -= 2;
-            if (!dun_data->laketype && (floor_ptr->dun_level > 80) && one_in_(count))
-                dun_data->laketype = LAKE_T_FIRE_VAULT;
+            if (!dd_ptr->laketype && (floor_ptr->dun_level > 80) && one_in_(count))
+                dd_ptr->laketype = LAKE_T_FIRE_VAULT;
 
             count--;
         }
 
-        if ((dungeon_ptr->flags1 & DF1_LAKE_WATER) && !dun_data->laketype) {
+        if ((dungeon_ptr->flags1 & DF1_LAKE_WATER) && !dd_ptr->laketype) {
             if ((floor_ptr->dun_level > 50) && randint0(count) < 2)
-                dun_data->laketype = LAKE_T_WATER;
+                dd_ptr->laketype = LAKE_T_WATER;
 
             count -= 2;
-            if (!dun_data->laketype && (floor_ptr->dun_level > 50) && one_in_(count))
-                dun_data->laketype = LAKE_T_WATER_VAULT;
+            if (!dd_ptr->laketype && (floor_ptr->dun_level > 50) && one_in_(count))
+                dd_ptr->laketype = LAKE_T_WATER_VAULT;
 
             count--;
         }
 
-        if ((dungeon_ptr->flags1 & DF1_LAKE_RUBBLE) && !dun_data->laketype) {
+        if ((dungeon_ptr->flags1 & DF1_LAKE_RUBBLE) && !dd_ptr->laketype) {
             if ((floor_ptr->dun_level > 35) && (randint0(count) < 2))
-                dun_data->laketype = LAKE_T_CAVE;
+                dd_ptr->laketype = LAKE_T_CAVE;
 
             count -= 2;
-            if (!dun_data->laketype && (floor_ptr->dun_level > 35) && one_in_(count))
-                dun_data->laketype = LAKE_T_EARTH_VAULT;
+            if (!dd_ptr->laketype && (floor_ptr->dun_level > 35) && one_in_(count))
+                dd_ptr->laketype = LAKE_T_EARTH_VAULT;
 
             count--;
         }
 
-        if ((floor_ptr->dun_level > 5) && (dungeon_ptr->flags1 & DF1_LAKE_TREE) && !dun_data->laketype)
-            dun_data->laketype = LAKE_T_AIR_VAULT;
+        if ((floor_ptr->dun_level > 5) && (dungeon_ptr->flags1 & DF1_LAKE_TREE) && !dd_ptr->laketype)
+            dd_ptr->laketype = LAKE_T_AIR_VAULT;
 
-        if (dun_data->laketype) {
+        if (dd_ptr->laketype) {
             msg_print_wizard(owner_ptr, CHEAT_DUNGEON, _("湖を生成します。", "Lake on the level."));
-            build_lake(owner_ptr, dun_data->laketype);
+            build_lake(owner_ptr, dd_ptr->laketype);
         }
     }
 
-    if ((floor_ptr->dun_level > DUN_CAVERN) && !dun_data->empty_level && (dungeon_ptr->flags1 & DF1_CAVERN) && !dun_data->laketype && !dun_data->destroyed
+    if ((floor_ptr->dun_level > DUN_CAVERN) && !dd_ptr->empty_level && (dungeon_ptr->flags1 & DF1_CAVERN) && !dd_ptr->laketype && !dd_ptr->destroyed
         && (randint1(1000) < floor_ptr->dun_level)) {
-        dun_data->cavern = TRUE;
+        dd_ptr->cavern = TRUE;
         msg_print_wizard(owner_ptr, CHEAT_DUNGEON, _("洞窟を生成。", "Cavern on level."));
         build_cavern(owner_ptr);
     }
 
     if (quest_number(owner_ptr, floor_ptr->dun_level))
-        dun_data->destroyed = FALSE;
+        dd_ptr->destroyed = FALSE;
 }
 
 bool has_river_flag(dungeon_type *dungeon_ptr)
index 4f37655..1e3e709 100644 (file)
@@ -3,7 +3,8 @@
 #include "system/angband.h"
 
 typedef struct dungeon_type dungeon_type;
+typedef struct dun_data_type dun_data_type;
 typedef struct dt_type dt_type;
-void gen_caverns_and_lakes(dungeon_type *dungeon_ptr, player_type *owner_ptr);
+void gen_caverns_and_lakes(player_type *owner_ptr, dungeon_type *dungeon_ptr, dun_data_type *dd_ptr);
 bool has_river_flag(dungeon_type *dungeon_ptr);
 void try_door(player_type *player_ptr, dt_type *dt_ptr, POSITION y, POSITION x);
index 257b6d4..383230b 100644 (file)
  * @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(player_type *player_ptr, EFFECT_ID typ)
+static bool room_build(player_type *player_ptr, dun_data_type *dd_ptr, EFFECT_ID typ)
 {
     switch (typ) {
     case ROOM_T_NORMAL:
-        return build_type1(player_ptr);
+        return build_type1(player_ptr, dd_ptr);
     case ROOM_T_OVERLAP:
-        return build_type2(player_ptr);
+        return build_type2(player_ptr, dd_ptr);
     case ROOM_T_CROSS:
-        return build_type3(player_ptr);
+        return build_type3(player_ptr, dd_ptr);
     case ROOM_T_INNER_FEAT:
-        return build_type4(player_ptr);
+        return build_type4(player_ptr, dd_ptr);
     case ROOM_T_NEST:
-        return build_type5(player_ptr);
+        return build_type5(player_ptr, dd_ptr);
     case ROOM_T_PIT:
-        return build_type6(player_ptr);
+        return build_type6(player_ptr, dd_ptr);
     case ROOM_T_LESSER_VAULT:
-        return build_type7(player_ptr);
+        return build_type7(player_ptr, dd_ptr);
     case ROOM_T_GREATER_VAULT:
-        return build_type8(player_ptr);
+        return build_type8(player_ptr, dd_ptr);
     case ROOM_T_FRACAVE:
-        return build_type9(player_ptr);
+        return build_type9(player_ptr, dd_ptr);
     case ROOM_T_RANDOM_VAULT:
-        return build_type10(player_ptr);
+        return build_type10(player_ptr, dd_ptr);
     case ROOM_T_OVAL:
-        return build_type11(player_ptr);
+        return build_type11(player_ptr, dd_ptr);
     case ROOM_T_CRYPT:
-        return build_type12(player_ptr);
+        return build_type12(player_ptr, dd_ptr);
     case ROOM_T_TRAP_PIT:
-        return build_type13(player_ptr);
+        return build_type13(player_ptr, dd_ptr);
     case ROOM_T_TRAP:
-        return build_type14(player_ptr);
+        return build_type14(player_ptr, dd_ptr);
     case ROOM_T_GLASS:
-        return build_type15(player_ptr);
+        return build_type15(player_ptr, dd_ptr);
     case ROOM_T_ARCADE:
-        return build_type16(player_ptr);
+        return build_type16(player_ptr, dd_ptr);
     case ROOM_T_FIXED:
-        return build_type17(player_ptr);
+        return build_type17(player_ptr, dd_ptr);
     default:
         return FALSE;
     }
@@ -84,7 +84,7 @@ static void move_prob_list(room_type dst, room_type src, int *prob_list)
  * @param player_ptr プレーヤーへの参照ポインタ
  * @return 部屋生成に成功した場合 TRUE を返す。
  */
-bool generate_rooms(player_type *player_ptr)
+bool generate_rooms(player_type *player_ptr, dun_data_type *dd_ptr)
 {
     floor_type *floor_ptr = player_ptr->current_floor_ptr;
     int crowded = 0;
@@ -133,7 +133,7 @@ bool generate_rooms(player_type *player_ptr)
     } else if (d_info[floor_ptr->dungeon_idx].flags1 & DF1_CAVE) {
         /*! @details ダンジョンにCAVEフラグがある場合、NORMALの生成枠がFRACAVEに与えられる。/ CAVE dungeon (Orc floor_ptr->grid_array etc.) */
         move_prob_list(ROOM_T_FRACAVE, ROOM_T_NORMAL, prob_list);
-    } else if (dun_data->cavern || dun_data->empty_level) {
+    } else if (dd_ptr->cavern || dd_ptr->empty_level) {
         /*! @details ダンジョンの基本地形が最初から渓谷かアリーナ型の場合 FRACAVE は生成から除外。 /  No caves when a (random) cavern exists: they look bad */
         prob_list[ROOM_T_FRACAVE] = 0;
     }
@@ -193,7 +193,7 @@ bool generate_rooms(player_type *player_ptr)
                 continue;
 
             room_num[room_type]--;
-            if (!room_build(player_ptr, room_type))
+            if (!room_build(player_ptr, dd_ptr, room_type))
                 continue;
 
             rooms_built++;
index 32faa42..3a3601a 100644 (file)
@@ -2,4 +2,5 @@
 
 #include "system/angband.h"
 
-bool generate_rooms(player_type *player_ptr);
+typedef struct dun_data_type dun_data_type;
+bool generate_rooms(player_type *player_ptr, dun_data_type *dun_data);
index 9e5864f..6722b54 100644 (file)
@@ -173,7 +173,7 @@ static void build_stores(player_type *player_ptr, POSITION ltcy, POSITION ltcx,
  * This function does NOT do anything about the owners of the stores,\n
  * nor the contents thereof.  It only handles the physical layout.\n
  */
-bool build_type16(player_type *player_ptr)
+bool build_type16(player_type *player_ptr, dun_data_type *dd_ptr)
 {
     int stores[] = {
         STORE_GENERAL,
@@ -213,7 +213,7 @@ bool build_type16(player_type *player_ptr)
         return FALSE;
     }
 
-    if (!find_space(player_ptr, &yval, &xval, town_hgt + 4, town_wid + 4)) {
+    if (!find_space(player_ptr, dd_ptr, &yval, &xval, town_hgt + 4, town_wid + 4)) {
         C_KILL(ugbldg, n, ugbldg_type);
         return FALSE;
     }
index 1ab3316..cda8d54 100644 (file)
@@ -2,8 +2,6 @@
 
 #include "system/angband.h"
 
-extern bool build_type16(player_type *player_ptr);
-
 /* Minimum & maximum town size */
 #define MIN_TOWN_WID ((MAX_WID / 3) / 2)
 #define MIN_TOWN_HGT ((MAX_HGT / 3) / 2)
@@ -11,11 +9,12 @@ extern bool build_type16(player_type *player_ptr);
 #define MAX_TOWN_HGT ((MAX_HGT / 3) * 2 / 3)
 
 /* Struct for build underground buildings */
-typedef struct
-{
+typedef struct ugbldg_type {
        POSITION y0, x0; /* North-west corner (relative) */
        POSITION y1, x1; /* South-east corner (relative) */
-}
-ugbldg_type;
+} ugbldg_type;
 
 ugbldg_type *ugbldg;
+
+typedef struct dun_data_type dun_data_type;
+bool build_type16(player_type *player_ptr, dun_data_type *dd_ptr);
index 30ddeb9..4464c49 100644 (file)
@@ -12,7 +12,7 @@
 * @brief タイプ9の部屋…フラクタルカーブによる洞窟生成 / Type 9 -- Driver routine to create fractal grid
 * @return なし
 */
-bool build_type9(player_type *player_ptr)
+bool build_type9(player_type *player_ptr, dun_data_type *dd_ptr)
 {
        int grd, roug, cutoff;
        POSITION xsize, ysize, y0, x0;
@@ -25,20 +25,20 @@ bool build_type9(player_type *player_ptr)
 
        /* Find and reserve some space in the dungeon.  Get center of room. */
        floor_type *floor_ptr = player_ptr->current_floor_ptr;
-       if (!find_space(player_ptr, &y0, &x0, ysize + 1, xsize + 1))
+        if (!find_space(player_ptr, dd_ptr, &y0, &x0, ysize + 1, xsize + 1))
        {
                /* Limit to the minimum room size, and retry */
                xsize = 8;
                ysize = 8;
 
                /* Find and reserve some space in the dungeon.  Get center of room. */
-               if (!find_space(player_ptr, &y0, &x0, ysize + 1, xsize + 1))
+                if (!find_space(player_ptr, dd_ptr, &y0, &x0, ysize + 1, xsize + 1))
                {
                        /*
                        * Still no space?!
                        * Try normal room
                        */
-                       return build_type1(player_ptr);
+                       return build_type1(player_ptr, dd_ptr);
                }
        }
 
index d8fbbbd..91fd017 100644 (file)
@@ -2,4 +2,5 @@
 
 #include "system/angband.h"
 
-bool build_type9(player_type *player_ptr);
+typedef struct dun_data_type dun_data_type;
+bool build_type9(player_type *player_ptr, dun_data_type *dd_ptr);
index f034a08..5057789 100644 (file)
@@ -14,7 +14,7 @@
  * @param player_ptr プレーヤーへの参照ポインタ
  * @return なし
  */
-bool build_type1(player_type *player_ptr)
+bool build_type1(player_type *player_ptr, dun_data_type *dd_ptr)
 {
     POSITION y, x, y2, x2, yval, xval;
     POSITION y1, x1, xsize, ysize;
@@ -36,7 +36,7 @@ bool build_type1(player_type *player_ptr)
     ysize = y1 + y2 + 1;
 
     /* Find and reserve some space in the dungeon.  Get center of room. */
-    if (!find_space(player_ptr, &yval, &xval, ysize + 2, xsize + 2)) {
+    if (!find_space(player_ptr, dd_ptr, &yval, &xval, ysize + 2, xsize + 2)) {
         /* Limit to the minimum room size, and retry */
         y1 = 1;
         x1 = 1;
@@ -47,7 +47,7 @@ bool build_type1(player_type *player_ptr)
         ysize = y1 + y2 + 1;
 
         /* Find and reserve some space in the dungeon.  Get center of room. */
-        if (!find_space(player_ptr, &yval, &xval, ysize + 2, xsize + 2))
+        if (!find_space(player_ptr, dd_ptr, &yval, &xval, ysize + 2, xsize + 2))
             return FALSE;
     }
 
@@ -188,7 +188,7 @@ bool build_type1(player_type *player_ptr)
  * @param player_ptr プレーヤーへの参照ポインタ
  * @return なし
  */
-bool build_type2(player_type *player_ptr)
+bool build_type2(player_type *player_ptr, dun_data_type *dd_ptr)
 {
     POSITION y, x, xval, yval;
     POSITION y1a, x1a, y2a, x2a;
@@ -198,7 +198,7 @@ bool build_type2(player_type *player_ptr)
 
     /* Find and reserve some space in the dungeon.  Get center of room. */
     floor_type *floor_ptr = player_ptr->current_floor_ptr;
-    if (!find_space(player_ptr, &yval, &xval, 11, 25))
+    if (!find_space(player_ptr, dd_ptr, &yval, &xval, 11, 25))
         return FALSE;
 
     /* Choose lite or dark */
@@ -299,7 +299,7 @@ bool build_type2(player_type *player_ptr)
  * the code below will work (with "bounds checking") for 5x5, or even\n
  * for unsymetric values like 4x3 or 5x3 or 3x4 or 3x5, or even larger.\n
  */
-bool build_type3(player_type *player_ptr)
+bool build_type3(player_type *player_ptr, dun_data_type *dd_ptr)
 {
     POSITION y, x, dy, dx, wy, wx;
     POSITION y1a, x1a, y2a, x2a;
@@ -310,7 +310,7 @@ bool build_type3(player_type *player_ptr)
 
     /* Find and reserve some space in the dungeon.  Get center of room. */
     floor_type *floor_ptr = player_ptr->current_floor_ptr;
-    if (!find_space(player_ptr, &yval, &xval, 11, 25))
+    if (!find_space(player_ptr, dd_ptr, &yval, &xval, 11, 25))
         return FALSE;
 
     /* Choose lite or dark */
@@ -537,7 +537,7 @@ bool build_type3(player_type *player_ptr)
  *     4 - Inner room has a maze\n
  *     5 - A set of four inner rooms\n
  */
-bool build_type4(player_type *player_ptr)
+bool build_type4(player_type *player_ptr, dun_data_type *dd_ptr)
 {
     POSITION y, x, y1, x1;
     POSITION y2, x2, tmp, yval, xval;
@@ -546,7 +546,7 @@ bool build_type4(player_type *player_ptr)
 
     /* Find and reserve some space in the dungeon.  Get center of room. */
     floor_type *floor_ptr = player_ptr->current_floor_ptr;
-    if (!find_space(player_ptr, &yval, &xval, 11, 25))
+    if (!find_space(player_ptr, dd_ptr, &yval, &xval, 11, 25))
         return FALSE;
 
     /* Choose lite or dark */
@@ -870,7 +870,7 @@ bool build_type4(player_type *player_ptr)
  *\n
  * When done fill from the inside to find the walls,\n
  */
-bool build_type11(player_type *player_ptr)
+bool build_type11(player_type *player_ptr, dun_data_type *dd_ptr)
 {
     POSITION rad, x, y, x0, y0;
     int light = FALSE;
@@ -883,7 +883,7 @@ bool build_type11(player_type *player_ptr)
     rad = randint0(9);
 
     /* Find and reserve some space in the dungeon.  Get center of room. */
-    if (!find_space(player_ptr, &y0, &x0, rad * 2 + 1, rad * 2 + 1))
+    if (!find_space(player_ptr, dd_ptr, &y0, &x0, rad * 2 + 1, rad * 2 + 1))
         return FALSE;
 
     /* Make circular floor */
@@ -915,7 +915,7 @@ bool build_type11(player_type *player_ptr)
  *\n
  * When done fill from the inside to find the walls,\n
  */
-bool build_type12(player_type *player_ptr)
+bool build_type12(player_type *player_ptr, dun_data_type *dd_ptr)
 {
     POSITION rad, x, y, x0, y0;
     int light = FALSE;
@@ -936,7 +936,7 @@ bool build_type12(player_type *player_ptr)
     rad = randint1(9);
 
     /* Find and reserve some space in the dungeon.  Get center of room. */
-    if (!find_space(player_ptr, &y0, &x0, rad * 2 + 3, rad * 2 + 3))
+    if (!find_space(player_ptr, dd_ptr, &y0, &x0, rad * 2 + 3, rad * 2 + 3))
         return FALSE;
 
     /* Make floor */
index e15443b..b7b1a02 100644 (file)
@@ -2,9 +2,10 @@
 
 #include "system/angband.h"
 
-bool build_type1(player_type *player_ptr);
-bool build_type2(player_type *player_ptr);
-bool build_type3(player_type *player_ptr);
-bool build_type4(player_type *player_ptr);
-bool build_type11(player_type *player_ptr);
-bool build_type12(player_type *player_ptr);
+typedef struct dun_data_type dun_data_type;
+bool build_type1(player_type *player_ptr, dun_data_type *dd_ptr);
+bool build_type2(player_type *player_ptr, dun_data_type *dd_ptr);
+bool build_type3(player_type *player_ptr, dun_data_type *dd_ptr);
+bool build_type4(player_type *player_ptr, dun_data_type *dd_ptr);
+bool build_type11(player_type *player_ptr, dun_data_type *dd_ptr);
+bool build_type12(player_type *player_ptr, dun_data_type *dd_ptr);
index 7871767..f34d449 100644 (file)
@@ -225,7 +225,7 @@ static void ang_sort_swap_nest_mon_info(player_type *player_ptr, vptr u, vptr v,
 *\n
 * Note that "monster nests" will never contain "unique" monsters.\n
 */
-bool build_type5(player_type *player_ptr)
+bool build_type5(player_type *player_ptr, dun_data_type *dd_ptr)
 {
        POSITION y, x, y1, x1, y2, x2, xval, yval;
        int i;
@@ -282,7 +282,7 @@ bool build_type5(player_type *player_ptr)
        }
 
        /* Find and reserve some space in the dungeon.  Get center of room. */
-       if (!find_space(player_ptr, &yval, &xval, 11, 25)) return FALSE;
+       if (!find_space(player_ptr, dd_ptr, &yval, &xval, 11, 25)) return FALSE;
 
        /* Large room */
        y1 = yval - 4;
@@ -436,7 +436,7 @@ bool build_type5(player_type *player_ptr)
 *\n
 * Note that "monster pits" will never contain "unique" monsters.\n
 */
-bool build_type6(player_type *player_ptr)
+bool build_type6(player_type *player_ptr, dun_data_type *dd_ptr)
 {
        POSITION y, x, y1, x1, y2, x2, xval, yval;
        int i, j;
@@ -493,7 +493,7 @@ bool build_type6(player_type *player_ptr)
        }
 
        /* Find and reserve some space in the dungeon.  Get center of room. */
-       if (!find_space(player_ptr, &yval, &xval, 11, 25)) return FALSE;
+       if (!find_space(player_ptr, dd_ptr, &yval, &xval, 11, 25)) return FALSE;
 
        /* Large room */
        y1 = yval - 4;
@@ -715,7 +715,7 @@ static bool vault_aux_trapped_pit(player_type *player_ptr, MONRACE_IDX r_idx)
 *\n
 * Note that "monster pits" will never contain "unique" monsters.\n
 */
-bool build_type13(player_type *player_ptr)
+bool build_type13(player_type *player_ptr, dun_data_type *dd_ptr)
 {
        POSITION y, x, y1, x1, y2, x2, xval, yval;
        int i, j;
@@ -775,7 +775,7 @@ bool build_type13(player_type *player_ptr)
        }
 
        /* Find and reserve some space in the dungeon.  Get center of room. */
-       if (!find_space(player_ptr, &yval, &xval, 13, 25)) return FALSE;
+       if (!find_space(player_ptr, dd_ptr, &yval, &xval, 13, 25)) return FALSE;
 
        /* Large room */
        y1 = yval - 5;
index a5c1ca7..231ce3c 100644 (file)
@@ -3,13 +3,12 @@
 #include "system/angband.h"
 
 /*! デバッグ時にnestのモンスター情報を確認するための構造体 / A struct for nest monster information with cheat_hear */
-typedef struct
-{
+typedef struct nest_mon_info_type {
        MONRACE_IDX r_idx;
        bool used;
-}
-nest_mon_info_type;
+} nest_mon_info_type;
 
-bool build_type5(player_type *player_ptr);
-bool build_type6(player_type *player_ptr);
-bool build_type13(player_type *player_ptr);
+typedef struct dun_data_type dun_data_type;
+bool build_type5(player_type *player_ptr, dun_data_type *dd_ptr);
+bool build_type6(player_type *player_ptr, dun_data_type *dd_ptr);
+bool build_type13(player_type *player_ptr, dun_data_type *dd_ptr);
index e9248fa..42b4110 100644 (file)
@@ -23,7 +23,7 @@
 * @param player_ptr プレーヤーへの参照ポインタ
 * @return なし
 */
-bool build_type15(player_type *player_ptr)
+bool build_type15(player_type *player_ptr, dun_data_type *dd_ptr)
 {
        POSITION y, x, y2, x2, yval, xval;
        POSITION y1, x1, xsize, ysize;
@@ -37,7 +37,7 @@ bool build_type15(player_type *player_ptr)
 
        /* Find and reserve some space in the dungeon.  Get center of room. */
        floor_type *floor_ptr = player_ptr->current_floor_ptr;
-       if (!find_space(player_ptr, &yval, &xval, ysize + 2, xsize + 2)) return FALSE;
+       if (!find_space(player_ptr, dd_ptr, &yval, &xval, ysize + 2, xsize + 2)) return FALSE;
 
        /* Choose lite or dark */
        light = ((floor_ptr->dun_level <= randint1(25)) && !(d_info[floor_ptr->dungeon_idx].flags1 & DF1_DARKNESS));
index f2e7bb7..4c51cf2 100644 (file)
@@ -2,4 +2,5 @@
 
 #include "system/angband.h"
 
-bool build_type15(player_type *player_ptr);
+typedef struct dun_data_type dun_data_type;
+bool build_type15(player_type *player_ptr, dun_data_type *dd_ptr);
index 6017aef..8712b77 100644 (file)
@@ -16,7 +16,7 @@
  * @details
  * A special trap is placed at center of the room
  */
-bool build_type14(player_type *player_ptr)
+bool build_type14(player_type *player_ptr, dun_data_type *dd_ptr)
 {
     POSITION y, x, y2, x2, yval, xval;
     POSITION y1, x1, xsize, ysize;
@@ -36,7 +36,7 @@ bool build_type14(player_type *player_ptr)
     ysize = y1 + y2 + 1;
 
     /* Find and reserve some space in the dungeon.  Get center of room. */
-    if (!find_space(player_ptr, &yval, &xval, ysize + 2, xsize + 2))
+    if (!find_space(player_ptr, dd_ptr, &yval, &xval, ysize + 2, xsize + 2))
         return FALSE;
 
     /* Choose lite or dark */
index 04a0498..b9fa10d 100644 (file)
@@ -2,4 +2,5 @@
 
 #include "system/angband.h"
 
-bool build_type14(player_type *player_ptr);
+typedef struct dun_data_type dun_data_type;
+bool build_type14(player_type *player_ptr, dun_data_type *dd_ptr);
index 0677315..497a0ab 100644 (file)
@@ -606,7 +606,7 @@ static void build_vault(
  * @brief タイプ7の部屋…v_info.txtより小型vaultを生成する / Type 7 -- simple vaults (see "v_info.txt")
  * @return なし
  */
-bool build_type7(player_type *player_ptr)
+bool build_type7(player_type *player_ptr, dun_data_type *dd_ptr)
 {
     vault_type *v_ptr = NULL;
     int dummy;
@@ -660,7 +660,7 @@ bool build_type7(player_type *player_ptr)
     }
 
     /* Find and reserve some space in the dungeon.  Get center of room. */
-    if (!find_space(player_ptr, &yval, &xval, abs(y), abs(x)))
+    if (!find_space(player_ptr, dd_ptr, &yval, &xval, abs(y), abs(x)))
         return FALSE;
 
     msg_format_wizard(player_ptr, CHEAT_DUNGEON, _("小型Vault(%s)を生成しました。", "Lesser vault (%s)."), v_name + v_ptr->name);
@@ -675,7 +675,7 @@ bool build_type7(player_type *player_ptr)
  * @brief タイプ8の部屋…v_info.txtより大型vaultを生成する / Type 8 -- greater vaults (see "v_info.txt")
  * @return なし
  */
-bool build_type8(player_type *player_ptr)
+bool build_type8(player_type *player_ptr, dun_data_type *dd_ptr)
 {
     vault_type *v_ptr;
     int dummy;
@@ -735,7 +735,7 @@ bool build_type8(player_type *player_ptr)
      * prevent generation of vaults with no-entrance.
      */
     /* Find and reserve some space in the dungeon.  Get center of room. */
-    if (!find_space(player_ptr, &yval, &xval, (POSITION)(abs(y) + 2), (POSITION)(abs(x) + 2)))
+    if (!find_space(player_ptr, dd_ptr, &yval, &xval, (POSITION)(abs(y) + 2), (POSITION)(abs(x) + 2)))
         return FALSE;
 
     msg_format_wizard(player_ptr, CHEAT_DUNGEON, _("大型固定Vault(%s)を生成しました。", "Greater vault (%s)."), v_name + v_ptr->name);
@@ -1087,7 +1087,7 @@ static void build_castle_vault(player_type *player_ptr, POSITION x0, POSITION y0
  * @param player_ptr プレーヤーへの参照ポインタ
  * @return なし
  */
-bool build_type10(player_type *player_ptr)
+bool build_type10(player_type *player_ptr, dun_data_type *dd_ptr)
 {
     POSITION y0, x0, xsize, ysize, vtype;
 
@@ -1097,7 +1097,7 @@ bool build_type10(player_type *player_ptr)
 
     /* Find and reserve some space in the dungeon.  Get center of room. */
     floor_type *floor_ptr = player_ptr->current_floor_ptr;
-    if (!find_space(player_ptr, &y0, &x0, ysize + 1, xsize + 1))
+    if (!find_space(player_ptr, dd_ptr, &y0, &x0, ysize + 1, xsize + 1))
         return FALSE;
 
     /* Select type of vault */
@@ -1150,7 +1150,7 @@ bool build_type10(player_type *player_ptr)
  * @brief タイプ17の部屋…v_info.txtより固定特殊部屋を生成する / Type 17 -- fixed special room (see "v_info.txt")
  * @return なし
  */
-bool build_type17(player_type *player_ptr)
+bool build_type17(player_type *player_ptr, dun_data_type *dd_ptr)
 {
     vault_type *v_ptr = NULL;
     int dummy;
@@ -1204,7 +1204,7 @@ bool build_type17(player_type *player_ptr)
     }
 
     /* Find and reserve some space in the dungeon.  Get center of room. */
-    if (!find_space(player_ptr, &yval, &xval, abs(y), abs(x)))
+    if (!find_space(player_ptr, dd_ptr, &yval, &xval, abs(y), abs(x)))
         return FALSE;
 
     msg_format_wizard(player_ptr, CHEAT_DUNGEON, _("特殊固定部屋(%s)を生成しました。", "Special Fix room (%s)."), v_name + v_ptr->name);
index e29db98..b0888d5 100644 (file)
@@ -17,7 +17,8 @@ extern char *v_name;
 extern char *v_text;
 extern VAULT_IDX max_v_idx;
 
-bool build_type7(player_type *player_ptr);
-bool build_type8(player_type *player_ptr);
-bool build_type10(player_type *player_ptr);
-bool build_type17(player_type *player_ptr);
+typedef struct dun_data_type dun_data_type;
+bool build_type7(player_type *player_ptr, dun_data_type *dd_ptr);
+bool build_type8(player_type *player_ptr, dun_data_type *dd_ptr);
+bool build_type10(player_type *player_ptr, dun_data_type *dd_ptr);
+bool build_type17(player_type *player_ptr, dun_data_type *dd_ptr);
index ae38274..b2069ce 100644 (file)
@@ -75,7 +75,7 @@ static void check_room_boundary(player_type *player_ptr, POSITION x1, POSITION y
  * @param block_x 範囲の左端
  * @return なし
  */
-static bool find_space_aux(POSITION blocks_high, POSITION blocks_wide, POSITION block_y, POSITION block_x)
+static bool find_space_aux(dun_data_type *dd_ptr, POSITION blocks_high, POSITION blocks_wide, POSITION block_y, POSITION block_x)
 {
     if (blocks_wide < 3) {
         if ((blocks_wide == 2) && (block_x % 3) == 2)
@@ -84,7 +84,7 @@ static bool find_space_aux(POSITION blocks_high, POSITION blocks_wide, POSITION
         if ((block_x % 3) != 0)
             return FALSE;
     } else {
-        if (block_x + (blocks_wide / 2) <= dun_data->col_rooms / 2) {
+        if (block_x + (blocks_wide / 2) <= dd_ptr->col_rooms / 2) {
             if (((block_x % 3) == 2) && ((blocks_wide % 3) == 2))
                 return FALSE;
             if ((block_x % 3) == 1)
@@ -102,12 +102,12 @@ static bool find_space_aux(POSITION blocks_high, POSITION blocks_wide, POSITION
     POSITION by2 = block_y + blocks_high;
     POSITION bx2 = block_x + blocks_wide;
 
-    if ((by1 < 0) || (by2 > dun_data->row_rooms) || (bx1 < 0) || (bx2 > dun_data->col_rooms))
+    if ((by1 < 0) || (by2 > dd_ptr->row_rooms) || (bx1 < 0) || (bx2 > dd_ptr->col_rooms))
         return FALSE;
 
     for (POSITION by = by1; by < by2; by++)
         for (POSITION bx = bx1; bx < bx2; bx++)
-            if (dun_data->room_map[by][bx])
+            if (dd_ptr->room_map[by][bx])
                 return FALSE;
 
     return TRUE;
@@ -134,20 +134,20 @@ static bool find_space_aux(POSITION blocks_high, POSITION blocks_wide, POSITION
  * Return TRUE and values for the center of the room if all went well.\n
  * Otherwise, return FALSE.\n
  */
-bool find_space(player_type *player_ptr, POSITION *y, POSITION *x, POSITION height, POSITION width)
+bool find_space(player_type *player_ptr, dun_data_type *dd_ptr, POSITION *y, POSITION *x, POSITION height, POSITION width)
 {
     int pick;
     POSITION block_y = 0;
     POSITION block_x = 0;
     POSITION blocks_high = 1 + ((height - 1) / BLOCK_HGT);
     POSITION blocks_wide = 1 + ((width - 1) / BLOCK_WID);
-    if ((dun_data->row_rooms < blocks_high) || (dun_data->col_rooms < blocks_wide))
+    if ((dd_ptr->row_rooms < blocks_high) || (dd_ptr->col_rooms < blocks_wide))
         return FALSE;
 
     int candidates = 0;
-    for (block_y = dun_data->row_rooms - blocks_high; block_y >= 0; block_y--) {
-        for (block_x = dun_data->col_rooms - blocks_wide; block_x >= 0; block_x--) {
-            if (find_space_aux(blocks_high, blocks_wide, block_y, block_x)) {
+    for (block_y = dd_ptr->row_rooms - blocks_high; block_y >= 0; block_y--) {
+        for (block_x = dd_ptr->col_rooms - blocks_wide; block_x >= 0; block_x--) {
+            if (find_space_aux(dd_ptr, blocks_high, blocks_wide, block_y, block_x)) {
                 /* Find a valid place */
                 candidates++;
             }
@@ -162,9 +162,9 @@ bool find_space(player_type *player_ptr, POSITION *y, POSITION *x, POSITION heig
     else
         pick = candidates / 2 + 1;
 
-    for (block_y = dun_data->row_rooms - blocks_high; block_y >= 0; block_y--) {
-        for (block_x = dun_data->col_rooms - blocks_wide; block_x >= 0; block_x--) {
-            if (find_space_aux(blocks_high, blocks_wide, block_y, block_x)) {
+    for (block_y = dd_ptr->row_rooms - blocks_high; block_y >= 0; block_y--) {
+        for (block_x = dd_ptr->col_rooms - blocks_wide; block_x >= 0; block_x--) {
+            if (find_space_aux(dd_ptr, blocks_high, blocks_wide, block_y, block_x)) {
                 pick--;
                 if (!pick)
                     break;
@@ -181,15 +181,15 @@ bool find_space(player_type *player_ptr, POSITION *y, POSITION *x, POSITION heig
     POSITION bx2 = block_x + blocks_wide;
     *y = ((by1 + by2) * BLOCK_HGT) / 2;
     *x = ((bx1 + bx2) * BLOCK_WID) / 2;
-    if (dun_data->cent_n < CENT_MAX) {
-        dun_data->cent[dun_data->cent_n].y = (byte)*y;
-        dun_data->cent[dun_data->cent_n].x = (byte)*x;
-        dun_data->cent_n++;
+    if (dd_ptr->cent_n < CENT_MAX) {
+        dd_ptr->cent[dd_ptr->cent_n].y = (byte)*y;
+        dd_ptr->cent[dd_ptr->cent_n].x = (byte)*x;
+        dd_ptr->cent_n++;
     }
 
     for (POSITION by = by1; by < by2; by++)
         for (POSITION bx = bx1; bx < bx2; bx++)
-            dun_data->room_map[by][bx] = TRUE;
+            dd_ptr->room_map[by][bx] = TRUE;
 
     check_room_boundary(player_ptr, *x - width / 2 - 1, *y - height / 2 - 1, *x + (width - 1) / 2 + 1, *y + (height - 1) / 2 + 1);
     return TRUE;
index bde2f71..097ad58 100644 (file)
@@ -2,4 +2,5 @@
 
 #include "system/angband.h"
 
-bool find_space(player_type *player_ptr, POSITION *y, POSITION *x, POSITION height, POSITION width);
+typedef struct dun_data_type dun_data_type;
+bool find_space(player_type *player_ptr, dun_data_type *dd_ptr, POSITION *y, POSITION *x, POSITION height, POSITION width);
diff --git a/src/system/dungeon-data-definition.c b/src/system/dungeon-data-definition.c
deleted file mode 100644 (file)
index b8bdf05..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-#include "system/dungeon-data-definition.h"
-
-/* Dungeon generation data -- see "cave_gen()" */
-dun_data_type *dun_data;
index 9fa1e83..bf81166 100644 (file)
@@ -65,5 +65,3 @@ typedef struct dun_data_type {
     bool cavern;
     int laketype;
 } dun_data_type;
-
-extern dun_data_type *dun_data;