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:
@@ -63,13 +63,15 @@ public:
|
||||
|
||||
cWorldStorage(void);
|
||||
~cWorldStorage();
|
||||
|
||||
|
||||
/** Queues a chunk to be loaded, asynchronously.
|
||||
The callback, if specified, will be called with the result of the load operation. */
|
||||
void QueueLoadChunk(int a_ChunkX, int a_ChunkZ, cChunkCoordCallback * a_Callback = nullptr);
|
||||
|
||||
/** Queues a chunk to be saved, asynchronously.
|
||||
The callback, if specified, will be called with the result of the save operation. */
|
||||
void QueueSaveChunk(int a_ChunkX, int a_ChunkZ, cChunkCoordCallback * a_Callback = nullptr);
|
||||
|
||||
void UnqueueLoad(int a_ChunkX, int a_ChunkZ);
|
||||
void UnqueueSave(const cChunkCoords & a_Chunk);
|
||||
|
||||
bool Start(cWorld * a_World, const AString & a_StorageSchemaName, int a_StorageCompressionFactor); // Hide the cIsThread's Start() method, we need to provide args
|
||||
void Stop(void); // Hide the cIsThread's Stop() method, we need to signal the event
|
||||
void WaitForFinish(void);
|
||||
|
||||
Reference in New Issue
Block a user