c_ptr = &cave[y][x];
/* Must be a "naked" floor grid */
- if (!cave_clean_bold(y, x) || c_ptr->m_idx) continue;
- if (!in_bounds(y,x)) continue;
+ if (c_ptr->m_idx) continue;
+ if (!have_flag(f_flags_grid(c_ptr), FF_MOVE)) continue;
+ if (!player_can_enter(c_ptr->feat, 0)) continue;
+ if (!in_bounds(y, x)) continue;
/* Refuse to start on anti-teleport grids */
if (c_ptr->info & (CAVE_ICKY)) continue;
c_ptr->mimic = room ? feat_wall_outer : fill_type[randint0(100)];
/* Floor type terrain cannot hide a door */
- if (feat_floor(c_ptr->mimic))
+ if (feat_supports_los(c_ptr->mimic) && !feat_supports_los(c_ptr->feat))
{
- c_ptr->feat = c_ptr->mimic;
+ if (have_flag(f_info[c_ptr->mimic].flags, FF_MOVE) || have_flag(f_info[c_ptr->mimic].flags, FF_CAN_FLY))
+ {
+ c_ptr->feat = one_in_(2) ? c_ptr->mimic : floor_type[randint0(100)];
+ }
c_ptr->mimic = 0;
}
}
}
-
/*
* Pick a random direction
*/
* corners of rooms off, as well as "silly" door placement, and
* "excessively wide" room entrances.
*
- * Useful "feat" values:
- * FEAT_WALL_EXTRA -- granite walls
- * FEAT_WALL_INNER -- inner room walls
- * FEAT_WALL_OUTER -- outer room walls
- * FEAT_WALL_SOLID -- solid room walls
- * FEAT_PERM_EXTRA -- shop walls (perma)
- * FEAT_PERM_INNER -- inner room walls (perma)
- * FEAT_PERM_OUTER -- outer room walls (perma)
- * FEAT_PERM_SOLID -- dungeon border (perma)
+ * Kind of walls:
+ * extra -- walls
+ * inner -- inner room walls
+ * outer -- outer room walls
+ * solid -- solid room walls
*/
void build_tunnel(int row1, int col1, int row2, int col2)
{
bool door_flag = FALSE;
cave_type *c_ptr;
+ feature_type *f_ptr;
/* Save the starting location */
start_row = row1;
/* Access the location */
c_ptr = &cave[tmp_row][tmp_col];
+ f_ptr = &f_info[c_ptr->feat];
+ if (permanent_wall(f_ptr))
+ {
+ /* Avoid the edge of vaults */
+ if (is_inner_grid(c_ptr)) continue;
+ }
- /* Avoid the edge of the dungeon */
- if (c_ptr->feat == FEAT_PERM_SOLID) continue;
-
- /* Avoid the edge of vaults */
- if (c_ptr->feat == FEAT_PERM_OUTER) continue;
-
- /* Avoid "solid" granite walls */
+ /* Avoid "solid" walls */
if (is_solid_grid(c_ptr)) continue;
/* Pierce "outer" walls of rooms */
if (is_outer_grid(c_ptr))
{
+ feature_type *ff_ptr;
+
/* Acquire the "next" location */
y = tmp_row + row_dir;
x = tmp_col + col_dir;
- /* Hack -- Avoid outer/solid permanent walls */
- if (cave[y][x].feat == FEAT_PERM_SOLID) continue;
- if (cave[y][x].feat == FEAT_PERM_OUTER) continue;
+ ff_ptr = &f_info[cave[y][x].feat];
- /* Hack -- Avoid outer/solid granite walls */
+ /* Hack -- Avoid outer/solid walls */
if (is_outer_bold(y, x)) continue;
if (is_solid_bold(y, x)) continue;
int feat, i, j, dx, dy;
cave_type *c_ptr = &cave[*y][*x];
+ feature_type *f_ptr;
if (!in_bounds(*y, *x)) return TRUE;
feat = c_ptr->feat;
+ f_ptr = &f_info[feat];
- if ((feat == FEAT_PERM_OUTER) ||
- (feat == FEAT_PERM_INNER) ||
- is_inner_grid(c_ptr))
+ if (is_inner_grid(c_ptr))
{
- /*
- * Ignore permanent walls - sometimes cannot tunnel around them anyway
- * so don't try - it just complicates things unnecessarily.
- */
return TRUE;
}
/* Save the tunnel location */
if (dun->tunn_n < TUNN_MAX)
{
- dun->tunn[dun->tunn_n].y = *y;
- dun->tunn[dun->tunn_n].x = *x;
- dun->tunn_n++;
+ dun->tunn[dun->tunn_n].y = *y;
+ dun->tunn[dun->tunn_n].x = *x;
+ dun->tunn_n++;
}
return TRUE;
return TRUE;
}
}
+