diff options
author | Tiger Wang <ziwei.tiger@outlook.com> | 2020-08-28 22:36:46 +0200 |
---|---|---|
committer | Tiger Wang <ziwei.tiger@outlook.com> | 2020-08-28 22:36:46 +0200 |
commit | da9158937d96e84bd39a7fbbbaace7cd4f8fe18c (patch) | |
tree | 0bd2613828e8ff500097760a91afaa6d7ca6d234 /src/WorldStorage/WorldStorage.cpp | |
parent | Clean up pickup collection to use ForEachEntityInBox (diff) | |
download | cuberite-da9158937d96e84bd39a7fbbbaace7cd4f8fe18c.tar cuberite-da9158937d96e84bd39a7fbbbaace7cd4f8fe18c.tar.gz cuberite-da9158937d96e84bd39a7fbbbaace7cd4f8fe18c.tar.bz2 cuberite-da9158937d96e84bd39a7fbbbaace7cd4f8fe18c.tar.lz cuberite-da9158937d96e84bd39a7fbbbaace7cd4f8fe18c.tar.xz cuberite-da9158937d96e84bd39a7fbbbaace7cd4f8fe18c.tar.zst cuberite-da9158937d96e84bd39a7fbbbaace7cd4f8fe18c.zip |
Diffstat (limited to 'src/WorldStorage/WorldStorage.cpp')
-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; } |