Cleaned up the maze placement so that I can have mazes without rooms and with other features.
This commit is contained in:
parent
37715f05a5
commit
20f03731e5
6 changed files with 34 additions and 25 deletions
25
map.cpp
25
map.cpp
|
@ -45,19 +45,26 @@ void Map::clear_target(const Point &at) {
|
|||
}
|
||||
|
||||
bool Map::place_entity(size_t room_index, Point &out) {
|
||||
dbc::check(room_index < $rooms.size(), "room_index is out of bounds, not enough rooms");
|
||||
if($rooms.size() == 0) {
|
||||
dbc::log("fucking dead end?");
|
||||
out = $dead_ends.at(room_index % $dead_ends.size());
|
||||
return true;
|
||||
} else {
|
||||
dbc::log("fucking fuckng fuck fuck");
|
||||
dbc::check(room_index < $rooms.size(), "room_index is out of bounds, not enough rooms");
|
||||
|
||||
Room &start = $rooms[room_index];
|
||||
Room &start = $rooms.at(room_index);
|
||||
|
||||
for(matrix::rando_rect it{$walls, start.x, start.y, start.width, start.height}; it.next();) {
|
||||
if(!iswall(it.x, it.y)) {
|
||||
out.x = it.x;
|
||||
out.y = it.y;
|
||||
return true;
|
||||
for(matrix::rando_rect it{$walls, start.x, start.y, start.width, start.height}; it.next();) {
|
||||
if(!iswall(it.x, it.y)) {
|
||||
out.x = it.x;
|
||||
out.y = it.y;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool Map::iswall(size_t x, size_t y) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue