* outer -- outer room walls
* solid -- solid room walls
*/
-void build_tunnel(int row1, int col1, int row2, int col2)
+bool build_tunnel(int row1, int col1, int row2, int col2)
{
int y, x;
int tmp_row, tmp_col;
while ((row1 != row2) || (col1 != col2))
{
/* Mega-Hack -- Paranoia -- prevent infinite loops */
- if (main_loop_count++ > 2000) break;
+ if (main_loop_count++ > 2000) return FALSE;
/* Allow bends in the tunnel */
if (randint0(100) < dun_tun_chg)
dun->wall[dun->wall_n].x = col1;
dun->wall_n++;
}
+ else return FALSE;
/* Forbid re-entry near this piercing */
for (y = row1 - 1; y <= row1 + 1; y++)
dun->tunn[dun->tunn_n].x = col1;
dun->tunn_n++;
}
+ else return FALSE;
/* Allow door in next grid */
door_flag = FALSE;
dun->door[dun->door_n].x = col1;
dun->door_n++;
}
+ else return FALSE;
/* No door in next grid */
door_flag = TRUE;
}
}
}
+
+ return TRUE;
}
dun->tunn[dun->tunn_n].y = *y;
dun->tunn[dun->tunn_n].x = *x;
dun->tunn_n++;
- }
- return TRUE;
+ return TRUE;
+ }
+ else return FALSE;
}
if (is_floor_bold(*y, *x))
dun->wall[dun->wall_n].x = *x;
dun->wall_n++;
}
+ else return FALSE;
/* Forbid re-entry near this piercing */
for (j = *y - 1; j <= *y + 1; j++)
dun->door[dun->door_n].x = x3;
dun->door_n++;
}
+ else return FALSE;
}
firstsuccede = TRUE;
}