diff options
Diffstat (limited to 'src/World/Generation/Generator.cpp')
| -rw-r--r-- | src/World/Generation/Generator.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/World/Generation/Generator.cpp b/src/World/Generation/Generator.cpp index 88e69a7..9d63fc1 100644 --- a/src/World/Generation/Generator.cpp +++ b/src/World/Generation/Generator.cpp @@ -24,7 +24,7 @@ Chunk Generator::generate(I64 chunk_x, I64 chunk_y) { } #define SIMPLE_MAP_GENERATOR(name, getter) \ -Generator::Map2D<Real> Generator::name(I64 chunk_x, I64 chunk_y) { \ +Generator::Map2D<Real> Generator::name(I64 chunk_x, I64 chunk_y) { \ Matrix<Chunk::Width, Chunk::Width> map{}; \ for (UInt x = 0; x < Chunk::Width; x++) { \ for (UInt y = 0; y < Chunk::Width; y++) { \ @@ -161,19 +161,20 @@ void Generator::decorate_soil(Chunk& chunk, Map2D<BiomeType>& biome_map, Map3D<B auto column_depth = 0; for (UInt y = Chunk::Height - 1; y > 0; y--) { + auto& place = chunk.at(x, y, z); auto block = terrain_map(x, y, z); if (block) { if (column_depth == 0 && y >= water_height - 1) { - chunk.set(x, y, z, {top_block}); + place = {top_block}; } else if (column_depth < dirt_depth) { - chunk.set(x, y, z, {soil_block}); + place = {soil_block}; } else { - chunk.set(x, y, z, {BlockType::Stone}); + place = {BlockType::Stone}; } column_depth++; } else { if (y < water_height) { - chunk.set(x, y, z, {BlockType::Water}); + place = {BlockType::Water}; } column_depth = 0; } @@ -181,7 +182,7 @@ void Generator::decorate_soil(Chunk& chunk, Map2D<BiomeType>& biome_map, Map3D<B } } - for (auto& decorator : s_decorators) { + for (auto decorator : s_decorators) { decorator->decorate_chunk(chunk); } } |
