Iterators are now working far more reliably and have more extensive tests that randomize inputs and fuzz them to check they keep working.

This commit is contained in:
Zed A. Shaw 2024-12-15 19:38:16 -05:00
parent 8e470df554
commit 70cd963e5c
11 changed files with 318 additions and 84 deletions

View file

@ -14,7 +14,7 @@ Map::Map(size_t width, size_t height) :
$width(width),
$height(height),
$walls(height, matrix::Row(width, INV_WALL)),
$paths(height, width)
$paths(width, height)
{}
Map::Map(Matrix &walls, Pathing &paths) :
@ -26,6 +26,7 @@ Map::Map(Matrix &walls, Pathing &paths) :
}
void Map::make_paths() {
INVARIANT();
$paths.compute_paths($walls);
}
@ -159,6 +160,8 @@ bool Map::INVARIANT() {
check($walls.size() == height(), "walls wrong height");
check($walls[0].size() == width(), "walls wrong width");
check($paths.$width == width(), "in Map paths width don't match map width");
check($paths.$height == height(), "in Map paths height don't match map height");
for(auto room : $rooms) {
check(int(room.x) >= 0 && int(room.y) >= 0,