Improved aborting chunk build.

This commit is contained in:
Relintai 2020-03-04 20:12:15 +01:00
parent 59291a9417
commit f9d13c611f

View File

@ -646,18 +646,18 @@ void VoxelChunk::build_prioritized() {
void VoxelChunk::_build_step() { void VoxelChunk::_build_step() {
ERR_FAIL_COND(!has_next_phase()); ERR_FAIL_COND(!has_next_phase());
while (has_next_phase() && build_phase()) while (has_next_phase() && build_phase() && !_abort_build)
; ;
//call the next non-threaded phase aswell //call the next non-threaded phase aswell
if (has_next_phase()) if (has_next_phase() && !_abort_build)
build_phase(); build_phase();
} }
void VoxelChunk::_build_threaded(void *_userdata) { void VoxelChunk::_build_threaded(void *_userdata) {
VoxelChunk *vc = (VoxelChunk *)_userdata; VoxelChunk *vc = (VoxelChunk *)_userdata;
while (vc->has_next_phase() && vc->build_phase()) while (vc->has_next_phase() && vc->build_phase() && !vc->_abort_build)
; ;
} }