diff options
author | faketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-01-01 17:20:52 +0100 |
---|---|---|
committer | faketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-01-01 17:20:52 +0100 |
commit | 01398f84244c0f4f06c8edb1e741937792f53eb2 (patch) | |
tree | f5095916be1019c48a8f86a357c23e3bce4a6148 /source/cWorld.cpp | |
parent | - implemented separated inventory for creative mode (cSurvivalInventory and cCreativeInventory) (diff) | |
download | cuberite-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 '')
-rw-r--r-- | source/cWorld.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/source/cWorld.cpp b/source/cWorld.cpp index 0b1ee7010..d10d01a0d 100644 --- a/source/cWorld.cpp +++ b/source/cWorld.cpp @@ -434,7 +434,8 @@ void cWorld::Tick(float a_Dt) //LOG("Spreading: %p", Chunk );
Chunk->SpreadLight( Chunk->pGetSkyLight() );
Chunk->SpreadLight( Chunk->pGetLight() );
- m_pState->SpreadQueue.remove( &*Chunk );
+ m_pState->SpreadQueue.remove( Chunk );
+ Chunk->RemoveReference();
TimesSpreaded++;
}
if( TimesSpreaded >= 50 )
@@ -676,6 +677,7 @@ void cWorld::UnloadUnusedChunks() m_LastUnload = m_Time;
LockChunks();
+ LOGINFO("Unloading unused chunks");
m_ChunkMap->UnloadUnusedChunks();
UnlockChunks();
}
@@ -1055,13 +1057,18 @@ void cWorld::ReSpreadLighting( cChunk* a_Chunk ) LockChunks();
m_pState->SpreadQueue.remove( a_Chunk );
m_pState->SpreadQueue.push_back( a_Chunk );
+#define STRINGIZE(x) #x
+ a_Chunk->AddReference( __FILE__ ": " STRINGIZE(__LINE__) );
UnlockChunks();
}
void cWorld::RemoveSpread( cChunk* a_Chunk )
{
LockChunks();
+ size_t SizeBefore = m_pState->SpreadQueue.size();
m_pState->SpreadQueue.remove( a_Chunk );
+ if( SizeBefore != m_pState->SpreadQueue.size() )
+ a_Chunk->RemoveReference();
UnlockChunks();
}
@@ -1102,3 +1109,10 @@ const char* cWorld::GetName() {
return m_pState->WorldName.c_str();
}
+int cWorld::GetNumChunks()
+{
+ LockChunks();
+ int NumChunks = m_ChunkMap->GetNumChunks();
+ UnlockChunks();
+ return NumChunks;
+}
\ No newline at end of file |