summaryrefslogtreecommitdiffstats
path: root/src/WorldStorage/WorldStorage.cpp
diff options
context:
space:
mode:
authorJulian Laubstein <julianlaubstein@yahoo.de>2016-02-06 11:37:34 +0100
committerJulian Laubstein <julianlaubstein@yahoo.de>2016-02-06 11:37:34 +0100
commit6fdd7194c81be7234a126bdc3b48f0291fce3567 (patch)
tree7d5ac74b7385ce4ebf77588d80549c884c2b993c /src/WorldStorage/WorldStorage.cpp
parentMerge pull request #2958 from LogicParrot/fence (diff)
parentBulk clearing of whitespace (diff)
downloadcuberite-6fdd7194c81be7234a126bdc3b48f0291fce3567.tar
cuberite-6fdd7194c81be7234a126bdc3b48f0291fce3567.tar.gz
cuberite-6fdd7194c81be7234a126bdc3b48f0291fce3567.tar.bz2
cuberite-6fdd7194c81be7234a126bdc3b48f0291fce3567.tar.lz
cuberite-6fdd7194c81be7234a126bdc3b48f0291fce3567.tar.xz
cuberite-6fdd7194c81be7234a126bdc3b48f0291fce3567.tar.zst
cuberite-6fdd7194c81be7234a126bdc3b48f0291fce3567.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;
}