Circle iterator now compensates for the matrix size and won't overflow.
This commit is contained in:
parent
35f2defc11
commit
857cd2f910
5 changed files with 25 additions and 23 deletions
|
@ -142,11 +142,9 @@ void WorldBuilder::generate() {
|
|||
$map.load_tiles();
|
||||
|
||||
Point center = $map.place_entity(1);
|
||||
for(matrix::circle it{center, 3}; it.next();) {
|
||||
for(matrix::circle it{$map.$walls, center, 3}; it.next();) {
|
||||
for(int x = it.left; x < it.right; x++) {
|
||||
if($map.inmap(x, it.y) && !$map.iswall(x, it.y)) {
|
||||
$map.$tiles.set_tile(x, it.y, "WATER_TILE");
|
||||
}
|
||||
$map.$tiles.set_tile(x, it.y, "WATER_TILE");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue