I can validate that a map is pathable, but can't fix it.

This commit is contained in:
Zed A. Shaw 2026-03-10 00:42:58 -04:00
parent 74f92dfe2c
commit 8090251a71
7 changed files with 116 additions and 21 deletions

View file

@ -11,10 +11,17 @@ namespace maze {
std::vector<Point>& $dead_ends;
std::unordered_map<Point, bool> $ends_map;
Room $no_rooms_region{0,0,0,0};
// BUG: instead of bool map it to the room?
std::unordered_map<Point, bool> $doors;
Pathing $paths;
Builder(Map& map) :
$walls(map.$walls), $rooms(map.$rooms), $dead_ends(map.$dead_ends)
$walls(map.$walls), $rooms(map.$rooms), $dead_ends(map.$dead_ends),
$paths{matrix::width(map.$walls), matrix::height(map.$walls)}
{
dbc::check(map.$width % 2 == 1, "map width not an ODD number (perimter dead ends bug)");
dbc::check(map.$height % 2 == 1, "map height not an ODD number (perimter dead ends bug)");
clear();
}
@ -31,7 +38,8 @@ namespace maze {
void perimeter(size_t x, size_t y, size_t width, size_t height, std::function<void(size_t x, size_t y)> cb);
void open_box(size_t outer_size);
void add_dead_end(Point at);
bool room_should_exist(Room& room);
bool room_should_exist(Room& room, bool allow_dupes=false);
void make_doors();
bool validate();
};
}