Avoid generating the same chunk more than once with multiple emerge threads.
This commit is contained in:
parent
9bb381ebd3
commit
f1d72d212a
@ -52,7 +52,6 @@ struct BlockMakeData {
|
|||||||
u64 seed = 0;
|
u64 seed = 0;
|
||||||
v3s16 blockpos_min;
|
v3s16 blockpos_min;
|
||||||
v3s16 blockpos_max;
|
v3s16 blockpos_max;
|
||||||
v3s16 blockpos_requested;
|
|
||||||
UniqueQueue<v3s16> transforming_liquid;
|
UniqueQueue<v3s16> transforming_liquid;
|
||||||
const NodeDefManager *nodedef = nullptr;
|
const NodeDefManager *nodedef = nullptr;
|
||||||
|
|
||||||
|
@ -1345,6 +1345,9 @@ bool ServerMap::initBlockMake(v3s16 blockpos, BlockMakeData *data)
|
|||||||
v3s16 bpmin = EmergeManager::getContainingChunk(blockpos, csize);
|
v3s16 bpmin = EmergeManager::getContainingChunk(blockpos, csize);
|
||||||
v3s16 bpmax = bpmin + v3s16(1, 1, 1) * (csize - 1);
|
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;
|
bool enable_mapgen_debug_info = m_emerge->enable_mapgen_debug_info;
|
||||||
EMERGE_DBG_OUT("initBlockMake(): " PP(bpmin) " - " PP(bpmax));
|
EMERGE_DBG_OUT("initBlockMake(): " PP(bpmin) " - " PP(bpmax));
|
||||||
|
|
||||||
@ -1360,7 +1363,6 @@ bool ServerMap::initBlockMake(v3s16 blockpos, BlockMakeData *data)
|
|||||||
data->seed = getSeed();
|
data->seed = getSeed();
|
||||||
data->blockpos_min = bpmin;
|
data->blockpos_min = bpmin;
|
||||||
data->blockpos_max = bpmax;
|
data->blockpos_max = bpmax;
|
||||||
data->blockpos_requested = blockpos;
|
|
||||||
data->nodedef = m_nodedef;
|
data->nodedef = m_nodedef;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1482,6 +1484,7 @@ void ServerMap::finishBlockMake(BlockMakeData *data,
|
|||||||
NOTE: Will be saved later.
|
NOTE: Will be saved later.
|
||||||
*/
|
*/
|
||||||
//save(MOD_STATE_WRITE_AT_UNLOAD);
|
//save(MOD_STATE_WRITE_AT_UNLOAD);
|
||||||
|
m_chunks_in_progress.erase(bpmin);
|
||||||
}
|
}
|
||||||
|
|
||||||
MapSector *ServerMap::createSector(v2s16 p2d)
|
MapSector *ServerMap::createSector(v2s16 p2d)
|
||||||
|
@ -423,6 +423,7 @@ private:
|
|||||||
// Chunks
|
// Chunks
|
||||||
core::map<v2s16, MapChunk*> m_chunks;
|
core::map<v2s16, MapChunk*> m_chunks;
|
||||||
#endif
|
#endif
|
||||||
|
std::set<v3s16> m_chunks_in_progress;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Metadata is re-written on disk only if this is true.
|
Metadata is re-written on disk only if this is true.
|
||||||
|
@ -260,12 +260,6 @@ void MapgenCarpathian::makeChunk(BlockMakeData *data)
|
|||||||
// Pre-conditions
|
// Pre-conditions
|
||||||
assert(data->vmanip);
|
assert(data->vmanip);
|
||||||
assert(data->nodedef);
|
assert(data->nodedef);
|
||||||
assert(data->blockpos_requested.X >= data->blockpos_min.X &&
|
|
||||||
data->blockpos_requested.Y >= data->blockpos_min.Y &&
|
|
||||||
data->blockpos_requested.Z >= data->blockpos_min.Z);
|
|
||||||
assert(data->blockpos_requested.X <= data->blockpos_max.X &&
|
|
||||||
data->blockpos_requested.Y <= data->blockpos_max.Y &&
|
|
||||||
data->blockpos_requested.Z <= data->blockpos_max.Z);
|
|
||||||
|
|
||||||
this->generating = true;
|
this->generating = true;
|
||||||
this->vm = data->vmanip;
|
this->vm = data->vmanip;
|
||||||
|
@ -209,12 +209,6 @@ void MapgenFlat::makeChunk(BlockMakeData *data)
|
|||||||
// Pre-conditions
|
// Pre-conditions
|
||||||
assert(data->vmanip);
|
assert(data->vmanip);
|
||||||
assert(data->nodedef);
|
assert(data->nodedef);
|
||||||
assert(data->blockpos_requested.X >= data->blockpos_min.X &&
|
|
||||||
data->blockpos_requested.Y >= data->blockpos_min.Y &&
|
|
||||||
data->blockpos_requested.Z >= data->blockpos_min.Z);
|
|
||||||
assert(data->blockpos_requested.X <= data->blockpos_max.X &&
|
|
||||||
data->blockpos_requested.Y <= data->blockpos_max.Y &&
|
|
||||||
data->blockpos_requested.Z <= data->blockpos_max.Z);
|
|
||||||
|
|
||||||
this->generating = true;
|
this->generating = true;
|
||||||
this->vm = data->vmanip;
|
this->vm = data->vmanip;
|
||||||
|
@ -209,12 +209,6 @@ void MapgenFractal::makeChunk(BlockMakeData *data)
|
|||||||
// Pre-conditions
|
// Pre-conditions
|
||||||
assert(data->vmanip);
|
assert(data->vmanip);
|
||||||
assert(data->nodedef);
|
assert(data->nodedef);
|
||||||
assert(data->blockpos_requested.X >= data->blockpos_min.X &&
|
|
||||||
data->blockpos_requested.Y >= data->blockpos_min.Y &&
|
|
||||||
data->blockpos_requested.Z >= data->blockpos_min.Z);
|
|
||||||
assert(data->blockpos_requested.X <= data->blockpos_max.X &&
|
|
||||||
data->blockpos_requested.Y <= data->blockpos_max.Y &&
|
|
||||||
data->blockpos_requested.Z <= data->blockpos_max.Z);
|
|
||||||
|
|
||||||
//TimeTaker t("makeChunk");
|
//TimeTaker t("makeChunk");
|
||||||
|
|
||||||
|
@ -50,12 +50,6 @@ void MapgenSinglenode::makeChunk(BlockMakeData *data)
|
|||||||
// Pre-conditions
|
// Pre-conditions
|
||||||
assert(data->vmanip);
|
assert(data->vmanip);
|
||||||
assert(data->nodedef);
|
assert(data->nodedef);
|
||||||
assert(data->blockpos_requested.X >= data->blockpos_min.X &&
|
|
||||||
data->blockpos_requested.Y >= data->blockpos_min.Y &&
|
|
||||||
data->blockpos_requested.Z >= data->blockpos_min.Z);
|
|
||||||
assert(data->blockpos_requested.X <= data->blockpos_max.X &&
|
|
||||||
data->blockpos_requested.Y <= data->blockpos_max.Y &&
|
|
||||||
data->blockpos_requested.Z <= data->blockpos_max.Z);
|
|
||||||
|
|
||||||
this->generating = true;
|
this->generating = true;
|
||||||
this->vm = data->vmanip;
|
this->vm = data->vmanip;
|
||||||
|
@ -201,12 +201,6 @@ void MapgenV5::makeChunk(BlockMakeData *data)
|
|||||||
// Pre-conditions
|
// Pre-conditions
|
||||||
assert(data->vmanip);
|
assert(data->vmanip);
|
||||||
assert(data->nodedef);
|
assert(data->nodedef);
|
||||||
assert(data->blockpos_requested.X >= data->blockpos_min.X &&
|
|
||||||
data->blockpos_requested.Y >= data->blockpos_min.Y &&
|
|
||||||
data->blockpos_requested.Z >= data->blockpos_min.Z);
|
|
||||||
assert(data->blockpos_requested.X <= data->blockpos_max.X &&
|
|
||||||
data->blockpos_requested.Y <= data->blockpos_max.Y &&
|
|
||||||
data->blockpos_requested.Z <= data->blockpos_max.Z);
|
|
||||||
|
|
||||||
this->generating = true;
|
this->generating = true;
|
||||||
this->vm = data->vmanip;
|
this->vm = data->vmanip;
|
||||||
|
@ -512,12 +512,6 @@ void MapgenV6::makeChunk(BlockMakeData *data)
|
|||||||
// Pre-conditions
|
// Pre-conditions
|
||||||
assert(data->vmanip);
|
assert(data->vmanip);
|
||||||
assert(data->nodedef);
|
assert(data->nodedef);
|
||||||
assert(data->blockpos_requested.X >= data->blockpos_min.X &&
|
|
||||||
data->blockpos_requested.Y >= data->blockpos_min.Y &&
|
|
||||||
data->blockpos_requested.Z >= data->blockpos_min.Z);
|
|
||||||
assert(data->blockpos_requested.X <= data->blockpos_max.X &&
|
|
||||||
data->blockpos_requested.Y <= data->blockpos_max.Y &&
|
|
||||||
data->blockpos_requested.Z <= data->blockpos_max.Z);
|
|
||||||
|
|
||||||
this->generating = true;
|
this->generating = true;
|
||||||
this->vm = data->vmanip;
|
this->vm = data->vmanip;
|
||||||
|
@ -317,12 +317,6 @@ void MapgenV7::makeChunk(BlockMakeData *data)
|
|||||||
// Pre-conditions
|
// Pre-conditions
|
||||||
assert(data->vmanip);
|
assert(data->vmanip);
|
||||||
assert(data->nodedef);
|
assert(data->nodedef);
|
||||||
assert(data->blockpos_requested.X >= data->blockpos_min.X &&
|
|
||||||
data->blockpos_requested.Y >= data->blockpos_min.Y &&
|
|
||||||
data->blockpos_requested.Z >= data->blockpos_min.Z);
|
|
||||||
assert(data->blockpos_requested.X <= data->blockpos_max.X &&
|
|
||||||
data->blockpos_requested.Y <= data->blockpos_max.Y &&
|
|
||||||
data->blockpos_requested.Z <= data->blockpos_max.Z);
|
|
||||||
|
|
||||||
//TimeTaker t("makeChunk");
|
//TimeTaker t("makeChunk");
|
||||||
|
|
||||||
|
@ -210,12 +210,6 @@ void MapgenValleys::makeChunk(BlockMakeData *data)
|
|||||||
// Pre-conditions
|
// Pre-conditions
|
||||||
assert(data->vmanip);
|
assert(data->vmanip);
|
||||||
assert(data->nodedef);
|
assert(data->nodedef);
|
||||||
assert(data->blockpos_requested.X >= data->blockpos_min.X &&
|
|
||||||
data->blockpos_requested.Y >= data->blockpos_min.Y &&
|
|
||||||
data->blockpos_requested.Z >= data->blockpos_min.Z);
|
|
||||||
assert(data->blockpos_requested.X <= data->blockpos_max.X &&
|
|
||||||
data->blockpos_requested.Y <= data->blockpos_max.Y &&
|
|
||||||
data->blockpos_requested.Z <= data->blockpos_max.Z);
|
|
||||||
|
|
||||||
//TimeTaker t("makeChunk");
|
//TimeTaker t("makeChunk");
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user