From 8e71de537636dbeb0be9d018a8518e49a7e8e667 Mon Sep 17 00:00:00 2001 From: LaG1924 <12997935+LaG1924@users.noreply.github.com> Date: Wed, 29 Jul 2020 08:26:36 +0500 Subject: Improved uncompressed chunks decoding --- src/World.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/World.cpp') diff --git a/src/World.cpp b/src/World.cpp index d767871..c3246dc 100644 --- a/src/World.cpp +++ b/src/World.cpp @@ -378,7 +378,12 @@ void World::SetBlockId(Vector pos, BlockId block) { std::floor(pos.y / 16.0), std::floor(pos.z / 16.0)); Vector blockPos = pos - (sectionPos * 16); - auto section = std::make_shared
(*GetSectionPtr(sectionPos)); + const Section* sectionPtr = GetSectionPtr(sectionPos); + if (!sectionPtr) { + LOG(ERROR) << "Updating unloaded chunk " << sectionPos; + return; + } + auto section = std::make_shared
(*sectionPtr); section->SetBlockId(blockPos, block); sections[sectionPos] = section; PUSH_EVENT("ChunkChanged",sectionPos); -- cgit v1.2.3