Cleaned up maze and ready to use.

This commit is contained in:
Zed A. Shaw 2025-05-20 10:32:20 -04:00
parent 33cd490ed3
commit 37715f05a5
3 changed files with 53 additions and 18 deletions

View file

@ -119,11 +119,7 @@ void maze::divide(Matrix& maze, Point start, Point end) {
}
}
void maze::hunt_and_kill(Matrix& maze, std::vector<Room>& rooms, std::vector<Point>& dead_ends, bool init_map) {
if(init_map) {
maze::init(maze);
}
void maze::hunt_and_kill(Matrix& maze, std::vector<Room>& rooms, std::vector<Point>& dead_ends) {
for(auto& room : rooms) {
for(matrix::box it{maze, room.x, room.y, room.width}; it.next();) {
@ -173,7 +169,28 @@ void maze::hunt_and_kill(Matrix& maze, std::vector<Room>& rooms, std::vector<Poi
}
}
void maze::inner_ring(Matrix& maze, size_t outer_size, size_t inner_size) {
void maze::inner_donut(Matrix& maze, float outer_rad, float inner_rad) {
size_t x = matrix::width(maze) / 2;
size_t y = matrix::height(maze) / 2;
for(matrix::circle it{maze, {x, y}, outer_rad};
it.next();)
{
for(int x = it.left; x < it.right; x++) {
maze[it.y][x] = 0;
}
}
for(matrix::circle it{maze, {x, y}, inner_rad};
it.next();)
{
for(int x = it.left; x < it.right; x++) {
maze[it.y][x] = 1;
}
}
}
void maze::inner_box(Matrix& maze, size_t outer_size, size_t inner_size) {
size_t x = matrix::width(maze) / 2;
size_t y = matrix::height(maze) / 2;