Circle iterator now compensates for the matrix size and won't overflow.

This commit is contained in:
Zed A. Shaw 2024-12-25 01:15:33 -05:00
parent 35f2defc11
commit 857cd2f910
5 changed files with 25 additions and 23 deletions

View file

@ -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");
}
}
}