From 44eedadc061bd9e04b05c1a22690aac3343f8115 Mon Sep 17 00:00:00 2001 From: MihailRis Date: Mon, 14 Oct 2024 20:47:37 +0300 Subject: [PATCH] make world generator less pedantic in structures placement --- src/world/generator/WorldGenerator.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/world/generator/WorldGenerator.cpp b/src/world/generator/WorldGenerator.cpp index 14c0c5aa..0f79c4e8 100644 --- a/src/world/generator/WorldGenerator.cpp +++ b/src/world/generator/WorldGenerator.cpp @@ -162,9 +162,11 @@ void WorldGenerator::placeStructure( AABB aabb(position, position + size); for (int lcz = -1; lcz <= 1; lcz++) { for (int lcx = -1; lcx <= 1; lcx++) { - auto& otherPrototype = requirePrototype( - chunkX + lcx, chunkZ + lcz - ); + const auto& found = prototypes.find({chunkX + lcx, chunkZ + lcz}); + if (found == prototypes.end()) { + continue; + } + auto& otherPrototype = *found->second; auto chunkAABB = gen_chunk_aabb(chunkX + lcx, chunkZ + lcz); if (chunkAABB.intersect(aabb)) { otherPrototype.placements.emplace_back(