|
|
|
@ -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) { |
|
|
|
|
m_walls = Matrix(height, MatrixRow(width, 0)); |
|
|
|
|
m_walls = Matrix(height, MatrixRow(width, 1)); |
|
|
|
|
m_input_map = Matrix(height, MatrixRow(width, 1)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -100,10 +100,7 @@ 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"); |
|
|
|
|
for(size_t x = origin_x; x < origin_x + w; ++x) { |
|
|
|
|
dbc::check(x < m_walls[y].size(), "x is out of bounds"); |
|
|
|
|
if(x == origin_x && y == origin_y) { |
|
|
|
|
m_input_map[y-1][x] = 0; |
|
|
|
|
} |
|
|
|
|
m_walls[y][x] = 1; |
|
|
|
|
m_walls[y][x] = 0; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -187,7 +184,6 @@ void partition_map(std::mt19937 &gen, Partition &cur, int depth) { |
|
|
|
|
println("!!!!LEAF LEFT ROOM h={}, w={}", left.height, left.width); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(depth > 0 && right.width >= 4 && right.height >= 4) { |
|
|
|
|
println("DOWN RIGHT h={}, w={}", right.height, right.width); |
|
|
|
|
partition_map(gen, right, depth-1); |
|
|
|
@ -201,7 +197,6 @@ void draw_map(Map *map, Partition &cur) { |
|
|
|
|
if(cur.x + cur.width <= map->width() |
|
|
|
|
&& cur.y + cur.height <= map->height()) |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
println("CUR NEXT SIZE: {}", cur.next.size()); |
|
|
|
|
if(cur.next.size() == 1) { |
|
|
|
|
draw_map(map, cur.next[0]); // left
|
|
|
|
|