1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Avoid generating the same chunk more than once with multiple emerge threads.

This commit is contained in:
Lars 2020-11-15 22:58:57 -08:00 committed by lhofhansl
parent 9bb381ebd3
commit f1d72d212a
11 changed files with 5 additions and 50 deletions

View file

@ -1345,6 +1345,9 @@ bool ServerMap::initBlockMake(v3s16 blockpos, BlockMakeData *data)
v3s16 bpmin = EmergeManager::getContainingChunk(blockpos, csize);
v3s16 bpmax = bpmin + v3s16(1, 1, 1) * (csize - 1);
if (!m_chunks_in_progress.insert(bpmin).second)
return false;
bool enable_mapgen_debug_info = m_emerge->enable_mapgen_debug_info;
EMERGE_DBG_OUT("initBlockMake(): " PP(bpmin) " - " PP(bpmax));
@ -1360,7 +1363,6 @@ bool ServerMap::initBlockMake(v3s16 blockpos, BlockMakeData *data)
data->seed = getSeed();
data->blockpos_min = bpmin;
data->blockpos_max = bpmax;
data->blockpos_requested = blockpos;
data->nodedef = m_nodedef;
/*
@ -1482,6 +1484,7 @@ void ServerMap::finishBlockMake(BlockMakeData *data,
NOTE: Will be saved later.
*/
//save(MOD_STATE_WRITE_AT_UNLOAD);
m_chunks_in_progress.erase(bpmin);
}
MapSector *ServerMap::createSector(v2s16 p2d)