fixed the map generator doing paths that hit the edge which made it look like the map was out of bounds.
This commit is contained in:
parent
194cc6664b
commit
6b4bc6cc11
5 changed files with 23 additions and 4 deletions
19
map.cpp
19
map.cpp
|
@ -180,3 +180,22 @@ bool Map::INVARIANT() {
|
|||
void Map::load_tiles() {
|
||||
$tiles.load($walls);
|
||||
}
|
||||
|
||||
void Map::expand() {
|
||||
// adjust width first
|
||||
for(auto &row : $walls) {
|
||||
row.insert(row.begin(), WALL_VALUE);
|
||||
row.push_back(WALL_VALUE);
|
||||
}
|
||||
$width = matrix::width($walls);
|
||||
|
||||
// then add two new rows top/bottom of that new width
|
||||
$walls.insert($walls.begin(), matrix::Row($width, WALL_VALUE));
|
||||
$walls.push_back(matrix::Row($width, WALL_VALUE));
|
||||
// now we have the new height
|
||||
$height = matrix::height($walls);
|
||||
|
||||
// reset the pathing and tiles and done
|
||||
$paths = Pathing($width, $height);
|
||||
$tiles = TileMap($width, $height);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue