From d08da0375a121b43de3f4e2b7807f801b85ec598 Mon Sep 17 00:00:00 2001 From: Relintai Date: Wed, 4 Mar 2020 20:49:00 +0100 Subject: [PATCH] Better way of handling the previous improvement. It will actually work now properly aswell. --- world/voxel_chunk.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/world/voxel_chunk.cpp b/world/voxel_chunk.cpp index ef6f8e6..a7b29c3 100644 --- a/world/voxel_chunk.cpp +++ b/world/voxel_chunk.cpp @@ -646,18 +646,18 @@ void VoxelChunk::build_prioritized() { void VoxelChunk::_build_step() { ERR_FAIL_COND(!has_next_phase()); - while (has_next_phase() && build_phase() && !_abort_build) + while (has_next_phase() && build_phase()) ; //call the next non-threaded phase aswell - if (has_next_phase() && !_abort_build) + if (has_next_phase()) build_phase(); } void VoxelChunk::_build_threaded(void *_userdata) { VoxelChunk *vc = (VoxelChunk *)_userdata; - while (vc->has_next_phase() && vc->build_phase() && !vc->_abort_build) + while (vc->has_next_phase() && vc->build_phase()) ; } @@ -665,6 +665,9 @@ bool VoxelChunk::build_phase() { _THREAD_SAFE_METHOD_ + if (_abort_build) + return false; + set_build_phase_done(false); return call("_build_phase", _current_build_phase);