diff options
author | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-08-15 13:54:13 +0200 |
---|---|---|
committer | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-08-15 13:54:13 +0200 |
commit | b687be9e44bc232b063365235541f871beeabfac (patch) | |
tree | f4cca078204a26171382ec7aba087a2e7a256c60 /source/WorldStorage.cpp | |
parent | Fix torches broken in rev 724 (diff) | |
download | cuberite-b687be9e44bc232b063365235541f871beeabfac.tar cuberite-b687be9e44bc232b063365235541f871beeabfac.tar.gz cuberite-b687be9e44bc232b063365235541f871beeabfac.tar.bz2 cuberite-b687be9e44bc232b063365235541f871beeabfac.tar.lz cuberite-b687be9e44bc232b063365235541f871beeabfac.tar.xz cuberite-b687be9e44bc232b063365235541f871beeabfac.tar.zst cuberite-b687be9e44bc232b063365235541f871beeabfac.zip |
Diffstat (limited to 'source/WorldStorage.cpp')
-rw-r--r-- | source/WorldStorage.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/source/WorldStorage.cpp b/source/WorldStorage.cpp index ce1c11322..b75520448 100644 --- a/source/WorldStorage.cpp +++ b/source/WorldStorage.cpp @@ -19,6 +19,13 @@ +/// 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 @@ -175,6 +182,20 @@ 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: + { + cCSLock Lock(m_CSQueues); + m_SaveQueue.push_back(cChunkCoords(0, CHUNK_Y_MESSAGE, 0)); + } + m_Event.Set(); +} + + + + + void cWorldStorage::UnqueueLoad(int a_ChunkX, int a_ChunkY, int a_ChunkZ) { cCSLock Lock(m_CSQueues); @@ -323,6 +344,11 @@ bool cWorldStorage::SaveOneChunk(void) } HasMore = !m_SaveQueue.empty(); } + if (Save.m_ChunkY == CHUNK_Y_MESSAGE) + { + LOGINFO("Saved all chunks in world %s", m_World->GetName().c_str()); + return HasMore; + } if (ShouldSave && m_World->IsChunkValid(Save.m_ChunkX, Save.m_ChunkY, Save.m_ChunkZ)) { m_World->MarkChunkSaving(Save.m_ChunkX, Save.m_ChunkY, Save.m_ChunkZ); |