summaryrefslogtreecommitdiffstats
path: root/source/cChunkMap.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/cChunkMap.cpp')
-rw-r--r--source/cChunkMap.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/source/cChunkMap.cpp b/source/cChunkMap.cpp
index 90b3258e7..d05fd4a43 100644
--- a/source/cChunkMap.cpp
+++ b/source/cChunkMap.cpp
@@ -462,7 +462,7 @@ void cChunkMap::UnloadUnusedChunks()
for( int i = 0; i < LAYER_SIZE*LAYER_SIZE; ++i )
{
cChunk* Chunk = Layer.m_Chunks[i].m_LiveChunk;
- if( Chunk && Chunk->GetClients().size() == 0 )
+ if( Chunk && Chunk->GetClients().size() == 0 && Chunk->GetReferenceCount() <= 0 )
{
Chunk->SaveToDisk();
World->RemoveSpread( Chunk );
@@ -716,3 +716,13 @@ cChunkMap::cChunkLayer* cChunkMap::LoadLayer(int a_LayerX, int a_LayerZ )
}
return 0;
}
+
+int cChunkMap::GetNumChunks()
+{
+ int NumChunks = 0;
+ for( int i = 0; i < m_NumLayers; ++i )
+ {
+ NumChunks += m_Layers[i].m_NumChunksLoaded;
+ }
+ return NumChunks;
+} \ No newline at end of file