Fixed up the map generator so that it's placing entities in non-overlapping tiles and adapting the style for the size. It can also deal with maps that have no rooms better and places the stairs better.
This commit is contained in:
parent
5f1a453fb4
commit
4eaf3c35d6
11 changed files with 55 additions and 45 deletions
16
maze.cpp
16
maze.cpp
|
@ -95,16 +95,12 @@ namespace maze {
|
|||
}
|
||||
|
||||
void Builder::randomize_rooms() {
|
||||
dbc::check($dead_ends.size() >= 2, "must have at least two possible points to place rooms");
|
||||
|
||||
while($rooms.size() < 2) {
|
||||
// use those dead ends to randomly place rooms
|
||||
for(auto at : $dead_ends) {
|
||||
if(Random::uniform(0,1)) {
|
||||
size_t offset = Random::uniform(0,1);
|
||||
Room cur{at.x+offset, at.y+offset, 1, 1};
|
||||
$rooms.push_back(cur);
|
||||
}
|
||||
// use those dead ends to randomly place rooms
|
||||
for(auto at : $dead_ends) {
|
||||
if(Random::uniform(0,1)) {
|
||||
size_t offset = Random::uniform(0,1);
|
||||
Room cur{at.x+offset, at.y+offset, 1, 1};
|
||||
$rooms.push_back(cur);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue