summaryrefslogtreecommitdiffstats
path: root/source/cWorld.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--source/cWorld.cpp16
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