summaryrefslogtreecommitdiffstats
path: root/src/WorldStorage/WorldStorage.cpp
diff options
context:
space:
mode:
authorLogicParrot <LogicParrot@users.noreply.github.com>2016-02-05 22:45:45 +0100
committerLogicParrot <LogicParrot@users.noreply.github.com>2016-02-05 22:50:18 +0100
commitca6ef58b1ee8521e4b940ee4883dee714960e413 (patch)
tree8532add455224b07c07a759e3d906f50c0695888 /src/WorldStorage/WorldStorage.cpp
parentMerge pull request #2972 from marvinkopf/PlayerAutoComplete (diff)
downloadcuberite-ca6ef58b1ee8521e4b940ee4883dee714960e413.tar
cuberite-ca6ef58b1ee8521e4b940ee4883dee714960e413.tar.gz
cuberite-ca6ef58b1ee8521e4b940ee4883dee714960e413.tar.bz2
cuberite-ca6ef58b1ee8521e4b940ee4883dee714960e413.tar.lz
cuberite-ca6ef58b1ee8521e4b940ee4883dee714960e413.tar.xz
cuberite-ca6ef58b1ee8521e4b940ee4883dee714960e413.tar.zst
cuberite-ca6ef58b1ee8521e4b940ee4883dee714960e413.zip
Diffstat (limited to 'src/WorldStorage/WorldStorage.cpp')
-rw-r--r--src/WorldStorage/WorldStorage.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/WorldStorage/WorldStorage.cpp b/src/WorldStorage/WorldStorage.cpp
index 3a2385848..55555d731 100644
--- a/src/WorldStorage/WorldStorage.cpp
+++ b/src/WorldStorage/WorldStorage.cpp
@@ -22,7 +22,7 @@ class cWSSForgetful :
{
public:
cWSSForgetful(cWorld * a_World) : cWSSchema(a_World) {}
-
+
protected:
// cWSSchema overrides:
virtual bool LoadChunk(const cChunkCoords & a_Chunk) override {return false; }
@@ -65,7 +65,7 @@ bool cWorldStorage::Start(cWorld * a_World, const AString & a_StorageSchemaName,
m_World = a_World;
m_StorageSchemaName = a_StorageSchemaName;
InitSchemas(a_StorageCompressionFactor);
-
+
return super::Start();
}
@@ -85,14 +85,14 @@ void cWorldStorage::Stop(void)
void cWorldStorage::WaitForFinish(void)
{
LOGD("Waiting for the world storage to finish saving");
-
+
{
m_LoadQueue.Clear();
}
-
+
// Wait for the saving to finish:
WaitForSaveQueueEmpty();
-
+
// Wait for the thread to finish:
m_ShouldTerminate = true;
m_Event.Set(); // Wake up the thread if waiting
@@ -170,7 +170,7 @@ void cWorldStorage::InitSchemas(int a_StorageCompressionFactor)
m_Schemas.push_back(new cWSSAnvil (m_World, a_StorageCompressionFactor));
m_Schemas.push_back(new cWSSForgetful(m_World));
// Add new schemas here
-
+
if (NoCaseCompare(m_StorageSchemaName, "default") == 0)
{
m_SaveSchema = m_Schemas.front();
@@ -184,7 +184,7 @@ void cWorldStorage::InitSchemas(int a_StorageCompressionFactor)
return;
}
} // for itr - m_Schemas[]
-
+
// Unknown schema selected, let the admin know:
LOGWARNING("Unknown storage schema name \"%s\". Using default (\"%s\"). Available schemas:",
m_StorageSchemaName.c_str(), m_SaveSchema->GetName().c_str()
@@ -213,7 +213,7 @@ void cWorldStorage::Execute(void)
{
return;
}
-
+
Success = LoadOneChunk();
Success |= SaveOneChunk();
} while (Success);
@@ -258,7 +258,7 @@ bool cWorldStorage::SaveOneChunk(void)
{
return false;
}
-
+
// Save the chunk, if it's valid:
bool Status = false;
if (m_World->IsChunkValid(ToSave.m_ChunkX, ToSave.m_ChunkZ))
@@ -286,7 +286,7 @@ bool cWorldStorage::SaveOneChunk(void)
bool cWorldStorage::LoadChunk(int a_ChunkX, int a_ChunkZ)
{
ASSERT(m_World->IsChunkQueued(a_ChunkX, a_ChunkZ));
-
+
cChunkCoords Coords(a_ChunkX, a_ChunkZ);
// First try the schema that is used for saving
@@ -294,7 +294,7 @@ bool cWorldStorage::LoadChunk(int a_ChunkX, int a_ChunkZ)
{
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)
{
@@ -303,10 +303,10 @@ bool cWorldStorage::LoadChunk(int a_ChunkX, int a_ChunkZ)
return true;
}
}
-
+
// Notify the chunk owner that the chunk failed to load (sets cChunk::m_HasLoadFailed to true):
m_World->ChunkLoadFailed(a_ChunkX, a_ChunkZ);
-
+
return false;
}