diff options
author | sfan5 <sfan5@live.de> | 2021-10-23 17:23:30 +0200 |
---|---|---|
committer | sfan5 <sfan5@live.de> | 2021-10-25 20:31:52 +0200 |
commit | 4ee643f472067356599946345f48fe7f743e6f38 (patch) | |
tree | deaedae365b0051d8121c984e3e57b236469b5a2 | |
parent | 1e26e4553033ebb11991721ba836e6425f556851 (diff) | |
download | minetest-4ee643f472067356599946345f48fe7f743e6f38.tar.gz minetest-4ee643f472067356599946345f48fe7f743e6f38.tar.bz2 minetest-4ee643f472067356599946345f48fe7f743e6f38.zip |
Fixes around emerge handling
-rw-r--r-- | src/emerge.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/emerge.cpp b/src/emerge.cpp index be64d744a..619b1fa8e 100644 --- a/src/emerge.cpp +++ b/src/emerge.cpp @@ -633,12 +633,14 @@ MapBlock *EmergeThread::finishGen(v3s16 pos, BlockMakeData *bmdata, m_server->setAsyncFatalError(e); } + EMERGE_DBG_OUT("ended up with: " << analyze_block(block)); + /* - Clear generate notifier events + Clear mapgen state */ + assert(!m_mapgen->generating); m_mapgen->gennotify.clearEvents(); - - EMERGE_DBG_OUT("ended up with: " << analyze_block(block)); + m_mapgen->vm = nullptr; /* Activate the block @@ -654,19 +656,19 @@ void *EmergeThread::run() BEGIN_DEBUG_EXCEPTION_HANDLER v3s16 pos; + std::map<v3s16, MapBlock *> modified_blocks; - m_map = (ServerMap *)&(m_server->m_env->getMap()); + m_map = &m_server->m_env->getServerMap(); m_emerge = m_server->m_emerge; m_mapgen = m_emerge->m_mapgens[id]; enable_mapgen_debug_info = m_emerge->enable_mapgen_debug_info; try { while (!stopRequested()) { - std::map<v3s16, MapBlock *> modified_blocks; BlockEmergeData bedata; BlockMakeData bmdata; EmergeAction action; - MapBlock *block; + MapBlock *block = nullptr; if (!popBlockEmerge(&pos, &bedata)) { m_queue_event.wait(); @@ -689,6 +691,8 @@ void *EmergeThread::run() } block = finishGen(pos, &bmdata, &modified_blocks); + if (!block) + action = EMERGE_ERRORED; } runCompletionCallbacks(pos, action, bedata.callbacks); @@ -698,6 +702,7 @@ void *EmergeThread::run() if (!modified_blocks.empty()) m_server->SetBlocksNotSent(modified_blocks); + modified_blocks.clear(); } } catch (VersionMismatchException &e) { std::ostringstream err; |