Fixed a race condition between chunk loader and generator.
When using ChunkWorx to generate multiple chunks, the server would sometimes fail an assert because it would generate a chunk even when it was successfully loaded. This was caused by chunks queued in cWorld's m_SetChunkDataQueue and thus being marked as "InQueue" although they were already loaded. Solved by adding a new parameter to chunk coord callbacks specifying whether the operation succeeded or failed, and using that instead of the chunk presence flag to decide whether to generate or not.
This commit is contained in:
@@ -348,11 +348,11 @@ static int tolua_cWorld_PrepareChunk(lua_State * tolua_S)
|
||||
}
|
||||
|
||||
// cChunkCoordCallback override:
|
||||
virtual void Call(int a_CBChunkX, int a_CBChunkZ) override
|
||||
virtual void Call(int a_CBChunkX, int a_CBChunkZ, bool a_IsSuccess) override
|
||||
{
|
||||
if (m_Callback.IsValid())
|
||||
{
|
||||
m_LuaState.Call(m_Callback, a_CBChunkX, a_CBChunkZ);
|
||||
m_LuaState.Call(m_Callback, a_CBChunkX, a_CBChunkZ, a_IsSuccess);
|
||||
}
|
||||
|
||||
// This is the last reference of this object, we must delete it so that it doesn't leak:
|
||||
|
||||
Reference in New Issue
Block a user