Pulled most of the variables out so now I can carve out functions.
This commit is contained in:
parent
a7f6357e12
commit
710076edfb
3 changed files with 7 additions and 194 deletions
5
map.cpp
5
map.cpp
|
@ -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_);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue