diff options
author | madmaxoft <github@xoft.cz> | 2014-07-04 11:50:50 +0200 |
---|---|---|
committer | madmaxoft <github@xoft.cz> | 2014-07-04 11:50:50 +0200 |
commit | 632e8680b181477ebf6713a593cc69d0193a425b (patch) | |
tree | e3fdb218e30b6f47c6b398b70d0c305265249844 /src/WorldStorage/WorldStorage.cpp | |
parent | APIDump: Updated OnWeatherChanging docs after latest code changes. (diff) | |
download | cuberite-632e8680b181477ebf6713a593cc69d0193a425b.tar cuberite-632e8680b181477ebf6713a593cc69d0193a425b.tar.gz cuberite-632e8680b181477ebf6713a593cc69d0193a425b.tar.bz2 cuberite-632e8680b181477ebf6713a593cc69d0193a425b.tar.lz cuberite-632e8680b181477ebf6713a593cc69d0193a425b.tar.xz cuberite-632e8680b181477ebf6713a593cc69d0193a425b.tar.zst cuberite-632e8680b181477ebf6713a593cc69d0193a425b.zip |
Diffstat (limited to 'src/WorldStorage/WorldStorage.cpp')
-rw-r--r-- | src/WorldStorage/WorldStorage.cpp | 35 |
1 files changed, 5 insertions, 30 deletions
diff --git a/src/WorldStorage/WorldStorage.cpp b/src/WorldStorage/WorldStorage.cpp index 6867ad5bc..d3f35384b 100644 --- a/src/WorldStorage/WorldStorage.cpp +++ b/src/WorldStorage/WorldStorage.cpp @@ -17,13 +17,6 @@ -/// If a chunk with this Y coord is de-queued, it is a signal to emit the saved-all message (cWorldStorage::QueueSavedMessage()) -#define CHUNK_Y_MESSAGE 2 - - - - - /// Example storage schema - forgets all chunks ;) class cWSSForgetful : public cWSSchema @@ -168,17 +161,6 @@ void cWorldStorage::QueueSaveChunk(int a_ChunkX, int a_ChunkY, int a_ChunkZ) -void cWorldStorage::QueueSavedMessage(void) -{ - // Pushes a special coord pair into the queue, signalizing a message instead - m_SaveQueue.EnqueueItem(cChunkCoords(0, CHUNK_Y_MESSAGE, 0)); - m_Event.Set(); -} - - - - - void cWorldStorage::UnqueueLoad(int a_ChunkX, int a_ChunkY, int a_ChunkZ) { m_LoadQueue.Remove(sChunkLoad(a_ChunkX, a_ChunkY, a_ChunkZ,true)); @@ -286,19 +268,12 @@ bool cWorldStorage::SaveOneChunk(void) { cChunkCoords ToSave(0, 0, 0); bool ShouldSave = m_SaveQueue.TryDequeueItem(ToSave); - if(ShouldSave) { - if (ToSave.m_ChunkY == CHUNK_Y_MESSAGE) - { - LOGINFO("Saved all chunks in world %s", m_World->GetName().c_str()); - return ShouldSave; - } - if (ShouldSave && m_World->IsChunkValid(ToSave.m_ChunkX, ToSave.m_ChunkZ)) + if (ShouldSave && m_World->IsChunkValid(ToSave.m_ChunkX, ToSave.m_ChunkZ)) + { + m_World->MarkChunkSaving(ToSave.m_ChunkX, ToSave.m_ChunkZ); + if (m_SaveSchema->SaveChunk(ToSave)) { - m_World->MarkChunkSaving(ToSave.m_ChunkX, ToSave.m_ChunkZ); - if (m_SaveSchema->SaveChunk(ToSave)) - { - m_World->MarkChunkSaved(ToSave.m_ChunkX, ToSave.m_ChunkZ); - } + m_World->MarkChunkSaved(ToSave.m_ChunkX, ToSave.m_ChunkZ); } } return ShouldSave; |