Results of today's code review session.
This commit is contained in:
parent
14b3ea7676
commit
f35b74f335
21 changed files with 64 additions and 59 deletions
8
map.cpp
8
map.cpp
|
@ -49,7 +49,13 @@ Point Map::place_entity(size_t room_index) {
|
|||
|
||||
Room &start = $rooms[room_index];
|
||||
|
||||
return {start.x+start.width/2, start.y+start.height/2};
|
||||
size_t size = std::max(start.width, start.height);
|
||||
for(matrix::box it{$walls, start.x, start.y, size}; it.next();) {
|
||||
if(!iswall(it.x, it.y)) return {it.x, it.y};
|
||||
}
|
||||
|
||||
dbc::sentinel("DIDN'T FIND AN OPEN SPACE!");
|
||||
return {start.x, start.y};
|
||||
}
|
||||
|
||||
bool Map::iswall(size_t x, size_t y) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue