If you invert the walls and the input map then you might be able to use the dijkstra map to find interesting paths between rooms.

main
Zed A. Shaw 10 months ago
parent 997a3ab45b
commit 68d6b9e90c
  1. 7
      map.cpp

@ -38,7 +38,7 @@ inline void add_neighbors(PairList &neighbors, Matrix &closed, size_t j, size_t
} }
Map::Map(size_t width, size_t height) : m_limit(1000) { Map::Map(size_t width, size_t height) : m_limit(1000) {
m_walls = Matrix(height, MatrixRow(width, 1)); m_walls = Matrix(height, MatrixRow(width, 0));
m_input_map = Matrix(height, MatrixRow(width, 1)); m_input_map = Matrix(height, MatrixRow(width, 1));
} }
@ -100,7 +100,10 @@ void Map::make_room(size_t origin_x, size_t origin_y, size_t w, size_t h) {
dbc::check(y < m_walls.size(), "y is out of bounds"); dbc::check(y < m_walls.size(), "y is out of bounds");
for(size_t x = origin_x; x < origin_x + w; ++x) { for(size_t x = origin_x; x < origin_x + w; ++x) {
dbc::check(x < m_walls[y].size(), "x is out of bounds"); dbc::check(x < m_walls[y].size(), "x is out of bounds");
m_walls[y][x] = 0; if(x == origin_x && y == origin_y) {
m_input_map[y-1][x] = 0;
}
m_walls[y][x] = 1;
} }
} }
} }

Loading…
Cancel
Save