diff options
Diffstat (limited to '')
-rw-r--r-- | src/WorldStorage/WorldStorage.cpp | 26 |
1 files changed, 7 insertions, 19 deletions
diff --git a/src/WorldStorage/WorldStorage.cpp b/src/WorldStorage/WorldStorage.cpp index 63e6e9625..c913eb15c 100644 --- a/src/WorldStorage/WorldStorage.cpp +++ b/src/WorldStorage/WorldStorage.cpp @@ -138,13 +138,13 @@ size_t cWorldStorage::GetSaveQueueLength(void) -void cWorldStorage::QueueLoadChunk(int a_ChunkX, int a_ChunkZ, cChunkCoordCallback * a_Callback) +void cWorldStorage::QueueLoadChunk(int a_ChunkX, int a_ChunkZ) { ASSERT((a_ChunkX > -0x08000000) && (a_ChunkX < 0x08000000)); ASSERT((a_ChunkZ > -0x08000000) && (a_ChunkZ < 0x08000000)); ASSERT(m_World->IsChunkQueued(a_ChunkX, a_ChunkZ)); - m_LoadQueue.EnqueueItem(cChunkCoordsWithCallback(a_ChunkX, a_ChunkZ, a_Callback)); + m_LoadQueue.EnqueueItem({ a_ChunkX, a_ChunkZ }); m_Event.Set(); } @@ -152,11 +152,11 @@ void cWorldStorage::QueueLoadChunk(int a_ChunkX, int a_ChunkZ, cChunkCoordCallba -void cWorldStorage::QueueSaveChunk(int a_ChunkX, int a_ChunkZ, cChunkCoordCallback * a_Callback) +void cWorldStorage::QueueSaveChunk(int a_ChunkX, int a_ChunkZ) { ASSERT(m_World->IsChunkValid(a_ChunkX, a_ChunkZ)); - m_SaveQueue.EnqueueItem(cChunkCoordsWithCallback(a_ChunkX, a_ChunkZ, a_Callback)); + m_SaveQueue.EnqueueItem({ a_ChunkX, a_ChunkZ }); m_Event.Set(); } @@ -227,7 +227,7 @@ void cWorldStorage::Execute(void) bool cWorldStorage::LoadOneChunk(void) { // Dequeue an item, bail out if there's none left: - cChunkCoordsWithCallback ToLoad(0, 0, nullptr); + cChunkCoords ToLoad(0, 0); bool ShouldLoad = m_LoadQueue.TryDequeueItem(ToLoad); if (!ShouldLoad) { @@ -235,14 +235,7 @@ bool cWorldStorage::LoadOneChunk(void) } // Load the chunk: - bool res = LoadChunk(ToLoad.m_ChunkX, ToLoad.m_ChunkZ); - - // Call the callback, if specified: - if (ToLoad.m_Callback != nullptr) - { - ToLoad.m_Callback->Call({ToLoad.m_ChunkX, ToLoad.m_ChunkZ}, res); - } - return res; + return LoadChunk(ToLoad.m_ChunkX, ToLoad.m_ChunkZ); } @@ -252,7 +245,7 @@ bool cWorldStorage::LoadOneChunk(void) bool cWorldStorage::SaveOneChunk(void) { // Dequeue one chunk to save: - cChunkCoordsWithCallback ToSave(0, 0, nullptr); + cChunkCoords ToSave(0, 0); bool ShouldSave = m_SaveQueue.TryDequeueItem(ToSave); if (!ShouldSave) { @@ -271,11 +264,6 @@ bool cWorldStorage::SaveOneChunk(void) } } - // Call the callback, if specified: - if (ToSave.m_Callback != nullptr) - { - ToSave.m_Callback->Call({ToSave.m_ChunkX, ToSave.m_ChunkZ}, Status); - } return true; } |