summaryrefslogtreecommitdiffstats
path: root/src/WorldStorage/WorldStorage.cpp
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2014-09-05 22:16:48 +0200
committerMattes D <github@xoft.cz>2014-09-05 22:16:48 +0200
commit137b021d26d47b11fc27df1c0b52f408f0ef5257 (patch)
tree462a02d3ab4ed76bfeb43db320435670be9f4d04 /src/WorldStorage/WorldStorage.cpp
parentBiomeMultiCache is not used for simple generators. (diff)
downloadcuberite-137b021d26d47b11fc27df1c0b52f408f0ef5257.tar
cuberite-137b021d26d47b11fc27df1c0b52f408f0ef5257.tar.gz
cuberite-137b021d26d47b11fc27df1c0b52f408f0ef5257.tar.bz2
cuberite-137b021d26d47b11fc27df1c0b52f408f0ef5257.tar.lz
cuberite-137b021d26d47b11fc27df1c0b52f408f0ef5257.tar.xz
cuberite-137b021d26d47b11fc27df1c0b52f408f0ef5257.tar.zst
cuberite-137b021d26d47b11fc27df1c0b52f408f0ef5257.zip
Diffstat (limited to 'src/WorldStorage/WorldStorage.cpp')
-rw-r--r--src/WorldStorage/WorldStorage.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/WorldStorage/WorldStorage.cpp b/src/WorldStorage/WorldStorage.cpp
index 667a28470..899b0beb3 100644
--- a/src/WorldStorage/WorldStorage.cpp
+++ b/src/WorldStorage/WorldStorage.cpp
@@ -143,6 +143,8 @@ size_t cWorldStorage::GetSaveQueueLength(void)
void cWorldStorage::QueueLoadChunk(int a_ChunkX, int a_ChunkZ, bool a_Generate)
{
+ ASSERT(m_World->IsChunkQueued(a_ChunkX, a_ChunkZ));
+
m_LoadQueue.EnqueueItem(sChunkLoad(a_ChunkX, a_ChunkZ, a_Generate));
m_Event.Set();
}
@@ -153,6 +155,8 @@ void cWorldStorage::QueueLoadChunk(int a_ChunkX, int a_ChunkZ, bool a_Generate)
void cWorldStorage::QueueSaveChunk(int a_ChunkX, int a_ChunkZ)
{
+ ASSERT(m_World->IsChunkValid(a_ChunkX, a_ChunkZ));
+
m_SaveQueue.EnqueueItemIfNotPresent(cChunkCoords(a_ChunkX, a_ChunkZ));
m_Event.Set();
}
@@ -244,6 +248,7 @@ bool cWorldStorage::LoadOneChunk(void)
{
sChunkLoad ToLoad(0, 0, false);
bool ShouldLoad = m_LoadQueue.TryDequeueItem(ToLoad);
+
if (ShouldLoad && !LoadChunk(ToLoad.m_ChunkX, ToLoad.m_ChunkZ))
{
if (ToLoad.m_Generate)
@@ -285,11 +290,7 @@ bool cWorldStorage::SaveOneChunk(void)
bool cWorldStorage::LoadChunk(int a_ChunkX, int a_ChunkZ)
{
- if (m_World->IsChunkValid(a_ChunkX, a_ChunkZ))
- {
- // Already loaded (can happen, since the queue is async)
- return true;
- }
+ ASSERT(m_World->IsChunkQueued(a_ChunkX, a_ChunkZ));
cChunkCoords Coords(a_ChunkX, a_ChunkZ);