From 54067d0ab23495d7bff1e7735b5ebacde4625e0a Mon Sep 17 00:00:00 2001 From: MihailRis Date: Fri, 23 Aug 2024 23:29:40 +0300 Subject: [PATCH] fix layers generation --- src/world/generator/WorldGenerator.cpp | 2 +- src/world/generator/WorldGenerator.hpp | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/world/generator/WorldGenerator.cpp b/src/world/generator/WorldGenerator.cpp index 5d3534e3..53649bf7 100644 --- a/src/world/generator/WorldGenerator.cpp +++ b/src/world/generator/WorldGenerator.cpp @@ -40,7 +40,7 @@ static inline void generate_pole( } else { layerHeight += layerExtension; } - layerHeight = std::min(static_cast(layerHeight), y); + layerHeight = std::min(static_cast(layerHeight), y+1); for (uint i = 0; i < layerHeight; i++, y--) { voxels[vox_index(x, y, z)].id = layer.rt.id; diff --git a/src/world/generator/WorldGenerator.hpp b/src/world/generator/WorldGenerator.hpp index a0cd4fe0..d8a32b16 100644 --- a/src/world/generator/WorldGenerator.hpp +++ b/src/world/generator/WorldGenerator.hpp @@ -26,17 +26,18 @@ struct ChunkPrototype { /// @brief High-level world generation controller class WorldGenerator { + /// @param def generator definition const GeneratorDef& def; + /// @param content world content const Content* content; + /// @param seed world seed uint64_t seed; - std::vector> chunks; - + /// @brief Generate chunk prototype (see ChunkPrototype) + /// @param x chunk position X divided by CHUNK_W + /// @param z chunk position Y divided by CHUNK_D std::unique_ptr generatePrototype(int x, int z); public: - /// @param def generator definition - /// @param content world content - /// @param seed world seed WorldGenerator( const GeneratorDef& def, const Content* content,