summaryrefslogtreecommitdiffstats
path: root/source/cChunkMap.cpp
diff options
context:
space:
mode:
authorfaketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-01-01 17:20:52 +0100
committerfaketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-01-01 17:20:52 +0100
commit01398f84244c0f4f06c8edb1e741937792f53eb2 (patch)
treef5095916be1019c48a8f86a357c23e3bce4a6148 /source/cChunkMap.cpp
parent- implemented separated inventory for creative mode (cSurvivalInventory and cCreativeInventory) (diff)
downloadcuberite-01398f84244c0f4f06c8edb1e741937792f53eb2.tar
cuberite-01398f84244c0f4f06c8edb1e741937792f53eb2.tar.gz
cuberite-01398f84244c0f4f06c8edb1e741937792f53eb2.tar.bz2
cuberite-01398f84244c0f4f06c8edb1e741937792f53eb2.tar.lz
cuberite-01398f84244c0f4f06c8edb1e741937792f53eb2.tar.xz
cuberite-01398f84244c0f4f06c8edb1e741937792f53eb2.tar.zst
cuberite-01398f84244c0f4f06c8edb1e741937792f53eb2.zip
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