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:
parent
8e470df554
commit
70cd963e5c
11 changed files with 318 additions and 84 deletions
5
map.cpp
5
map.cpp
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue