summaryrefslogtreecommitdiffstats
path: root/source/WorldStorage.cpp
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-02-28 11:45:53 +0100
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-02-28 11:45:53 +0100
commit230f98a774d956934e42cb4ba7b2cddcdc365676 (patch)
tree0049f65fefb73d9bd8c4c3adcc076634451d5271 /source/WorldStorage.cpp
parentVC2008: slight project reorganization, chunk-generation-related sources are now in one folder (diff)
downloadcuberite-230f98a774d956934e42cb4ba7b2cddcdc365676.tar
cuberite-230f98a774d956934e42cb4ba7b2cddcdc365676.tar.gz
cuberite-230f98a774d956934e42cb4ba7b2cddcdc365676.tar.bz2
cuberite-230f98a774d956934e42cb4ba7b2cddcdc365676.tar.lz
cuberite-230f98a774d956934e42cb4ba7b2cddcdc365676.tar.xz
cuberite-230f98a774d956934e42cb4ba7b2cddcdc365676.tar.zst
cuberite-230f98a774d956934e42cb4ba7b2cddcdc365676.zip
Diffstat (limited to 'source/WorldStorage.cpp')
-rw-r--r--source/WorldStorage.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/source/WorldStorage.cpp b/source/WorldStorage.cpp
index 2d8d5bbc7..17c58c549 100644
--- a/source/WorldStorage.cpp
+++ b/source/WorldStorage.cpp
@@ -335,7 +335,8 @@ bool cWorldStorage::LoadOneChunk(void)
}
HasMore = (m_LoadQueue.size() > 0);
}
- if (ShouldLoad && !LoadChunk(cChunkCoords(ToLoad.m_ChunkX, ToLoad.m_ChunkY, ToLoad.m_ChunkZ)))
+
+ if (ShouldLoad && !LoadChunk(ToLoad.m_ChunkX, ToLoad.m_ChunkY, ToLoad.m_ChunkZ))
{
if (ToLoad.m_Generate)
{
@@ -389,22 +390,26 @@ bool cWorldStorage::SaveOneChunk(void)
-bool cWorldStorage::LoadChunk(const cChunkCoords & a_Chunk)
+bool cWorldStorage::LoadChunk(int a_ChunkX, int a_ChunkY, int a_ChunkZ)
{
- if (m_World->IsChunkValid(a_Chunk.m_ChunkX, a_Chunk.m_ChunkY, a_Chunk.m_ChunkZ))
+ if (m_World->IsChunkValid(a_ChunkX, a_ChunkY, a_ChunkZ))
{
// Already loaded (can happen, since the queue is async)
return true;
}
- if (m_SaveSchema->LoadChunk(a_Chunk))
+ cChunkCoords Coords(a_ChunkX, a_ChunkY, a_ChunkZ);
+
+ // First try the schema that is used for saving
+ if (m_SaveSchema->LoadChunk(Coords))
{
return true;
}
+ // If it didn't have the chunk, try all the other schemas:
for (cWSSchemaList::iterator itr = m_Schemas.begin(); itr != m_Schemas.end(); ++itr)
{
- if (((*itr) != m_SaveSchema) && (*itr)->LoadChunk(a_Chunk))
+ if (((*itr) != m_SaveSchema) && (*itr)->LoadChunk(Coords))
{
return true;
}