* routine.\n
* @todo 特に詳細な処理の意味を調査すべし
*/
-static bool set_tunnel(POSITION *x, POSITION *y, bool affectwall)
+static bool set_tunnel(floor_type *floor_ptr, POSITION *x, POSITION *y, bool affectwall)
{
int i, j, dx, dy;
- grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[*y][*x];
+ grid_type *g_ptr = &floor_ptr->grid_array[*y][*x];
- if (!in_bounds(p_ptr->current_floor_ptr, *y, *x)) return TRUE;
+ if (!in_bounds(floor_ptr, *y, *x)) return TRUE;
if (is_inner_grid(g_ptr))
{
return TRUE;
}
- if (is_extra_bold(p_ptr->current_floor_ptr, *y, *x))
+ if (is_extra_bold(floor_ptr, *y, *x))
{
/* Save the tunnel location */
if (dun->tunn_n < TUNN_MAX)
else return FALSE;
}
- if (is_floor_bold(p_ptr->current_floor_ptr, *y, *x))
+ if (is_floor_bold(floor_ptr, *y, *x))
{
/* Don't do anything */
return TRUE;
for (i = *x - 1; i <= *x + 1; i++)
{
/* Convert adjacent "outer" walls as "solid" walls */
- if (is_outer_bold(p_ptr->current_floor_ptr, j, i))
+ if (is_outer_bold(floor_ptr, j, i))
{
/* Change the wall to a "solid" wall */
place_solid_noperm_bold(j, i);
}
/* Clear mimic type */
- p_ptr->current_floor_ptr->grid_array[*y][*x].mimic = 0;
+ floor_ptr->grid_array[*y][*x].mimic = 0;
place_floor_bold(*y, *x);
dy = 0;
dx = 0;
- while ((i > 0) && is_solid_bold(p_ptr->current_floor_ptr, *y + dy, *x + dx))
+ while ((i > 0) && is_solid_bold(floor_ptr, *y + dy, *x + dx))
{
dy = randint0(3) - 1;
dx = randint0(3) - 1;
- if (!in_bounds(p_ptr->current_floor_ptr, *y + dy, *x + dx))
+ if (!in_bounds(floor_ptr, *y + dy, *x + dx))
{
dx = 0;
dy = 0;
/* Build tunnel */
x1 = x - 1;
y1 = y;
- set_tunnel(&x1, &y1, FALSE);
+ set_tunnel(p_ptr->current_floor_ptr, &x1, &y1, FALSE);
x1 = x + 1;
y1 = y;
- set_tunnel(&x1, &y1, FALSE);
+ set_tunnel(p_ptr->current_floor_ptr, &x1, &y1, FALSE);
x1 = x;
y1 = y - 1;
- set_tunnel(&x1, &y1, FALSE);
+ set_tunnel(p_ptr->current_floor_ptr, &x1, &y1, FALSE);
x1 = x;
y1 = y + 1;
- set_tunnel(&x1, &y1, FALSE);
+ set_tunnel(p_ptr->current_floor_ptr, &x1, &y1, FALSE);
}
{
x = x1 + i * (x2 - x1) / length;
y = y1 + i * (y2 - y1) / length;
- if (!set_tunnel(&x, &y, TRUE))
+ if (!set_tunnel(p_ptr->current_floor_ptr, &x, &y, TRUE))
{
if (count > 50)
{
{
x = i;
y = y1;
- if (!set_tunnel(&x, &y, TRUE))
+ if (!set_tunnel(p_ptr->current_floor_ptr, &x, &y, TRUE))
{
/* solid wall - so try to go around */
short_seg_hack(x, y, i - 1, y1, 1, count, fail);
{
x = i;
y = y1;
- if (!set_tunnel(&x, &y, TRUE))
+ if (!set_tunnel(p_ptr->current_floor_ptr, &x, &y, TRUE))
{
/* solid wall - so try to go around */
short_seg_hack(x, y, i - 1, y1, 1, count, fail);
{
x = x2;
y = i;
- if (!set_tunnel(&x, &y, TRUE))
+ if (!set_tunnel(p_ptr->current_floor_ptr, &x, &y, TRUE))
{
/* solid wall - so try to go around */
short_seg_hack(x, y, x2, i - 1, 1, count, fail);
{
x = x2;
y = i;
- if (!set_tunnel(&x, &y, TRUE))
+ if (!set_tunnel(p_ptr->current_floor_ptr, &x, &y, TRUE))
{
/* solid wall - so try to go around */
short_seg_hack(x, y, x2, i - 1, 1, count, fail);
if (firstsuccede)
{
/* only do this if the first half has worked */
- set_tunnel(&x3, &y3, TRUE);
+ set_tunnel(p_ptr->current_floor_ptr, &x3, &y3, TRUE);
}
/* return value calculated above */
return retval;