<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
<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>
*/
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);
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)) {
}
} 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;
}
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) {
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];
}
}
- 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);
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);
}
}
- 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);
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)
* @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;
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;
}
}
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++;
}
}
#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);
* 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;
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))
} 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;
}
* 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];
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;
}
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))
* 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);
}
/*!
* 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;
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);
}
}
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);
}
}
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);
}
}
}
* 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;
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;
}
}
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;
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;
}
if (firstsuccede)
- set_tunnel(player_ptr, &x3, &y3, TRUE);
+ set_tunnel(player_ptr, dd_ptr, &x3, &y3, TRUE);
return retval;
}
#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);
* @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;
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)
#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);
* @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;
}
* @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;
} 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;
}
continue;
room_num[room_type]--;
- if (!room_build(player_ptr, room_type))
+ if (!room_build(player_ptr, dd_ptr, room_type))
continue;
rooms_built++;
#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);
* 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,
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;
}
#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)
#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);
* @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;
/* 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);
}
}
#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);
* @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;
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;
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;
}
* @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;
/* 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 */
* 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;
/* 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 */
* 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;
/* 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 */
*\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;
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 */
*\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;
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 */
#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);
*\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;
}
/* 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;
*\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;
}
/* 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;
*\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;
}
/* 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;
#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);
* @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;
/* 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));
#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);
* @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;
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 */
#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);
* @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;
}
/* 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);
* @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;
* 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);
* @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;
/* 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 */
* @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;
}
/* 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);
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);
* @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)
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)
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;
* 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++;
}
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;
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;
#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);
+++ /dev/null
-#include "system/dungeon-data-definition.h"
-
-/* Dungeon generation data -- see "cave_gen()" */
-dun_data_type *dun_data;
bool cavern;
int laketype;
} dun_data_type;
-
-extern dun_data_type *dun_data;