From 2b057a0977a805afe5902bf59304575714698977 Mon Sep 17 00:00:00 2001 From: MihailRis Date: Thu, 24 Oct 2024 13:27:32 +0300 Subject: [PATCH] fix: core:struct_air is being replaced with plants --- src/world/generator/WorldGenerator.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/world/generator/WorldGenerator.cpp b/src/world/generator/WorldGenerator.cpp index 8acc76e1..f585e71b 100644 --- a/src/world/generator/WorldGenerator.cpp +++ b/src/world/generator/WorldGenerator.cpp @@ -449,14 +449,17 @@ void WorldGenerator::generate(voxel* voxels, int chunkX, int chunkZ) { generatePlacements(prototype, voxels, chunkX, chunkZ); generatePlants(prototype, values, voxels, chunkX, chunkZ, biomes); -#ifndef NDEBUG for (uint i = 0; i < CHUNK_VOL; i++) { - blockid_t id = voxels[i].id; + blockid_t& id = voxels[i].id; + if (id == BLOCK_STRUCT_AIR) { + id = BLOCK_AIR; + } +#ifndef NDEBUG if (indices.get(id) == nullptr) { abort(); } - } #endif + } } void WorldGenerator::generatePlacements( @@ -514,11 +517,7 @@ void WorldGenerator::generateStructure( const auto& structVoxel = structVoxels[vox_index(x, y, z, size.x, size.z)]; if (structVoxel.id) { - if (structVoxel.id == BLOCK_STRUCT_AIR) { - voxels[vox_index(sx, sy, sz)] = {0, {}}; - } else { - voxels[vox_index(sx, sy, sz)] = structVoxel; - } + voxels[vox_index(sx, sy, sz)] = structVoxel; } } }