Pulled most of the variables out so now I can carve out functions.

This commit is contained in:
Zed A. Shaw 2024-10-02 18:14:54 -04:00
parent a7f6357e12
commit 710076edfb
3 changed files with 7 additions and 194 deletions

View file

@ -263,6 +263,8 @@ bool Map::walk(Point &src, Point &target) {
make_paths();
bool found = false;
Point out{src.x, src.y};
int count = 0;
do {
walls_[out.y][out.x] = INV_SPACE;
found = neighbors(out, true);
@ -271,7 +273,7 @@ bool Map::walk(Point &src, Point &target) {
walls_[out.y][out.x] = INV_SPACE;
return true;
}
} while(found && out.x > 0 && out.y > 0);
} while(found && out.x > 0 && out.y > 0 && ++count < 100);
return false;
}
@ -324,7 +326,6 @@ bool Map::iswall(size_t x, size_t y) {
return walls_[y][x] == WALL_VALUE;
}
void Map::dump() {
dump_map("PATHS", paths_);
dump_map("WALLS", walls_);