summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rw-r--r--source/cChunkMap.cpp3
-rw-r--r--source/cChunkMap.h9
2 files changed, 11 insertions, 1 deletions
diff --git a/source/cChunkMap.cpp b/source/cChunkMap.cpp
index efb69aca0..6f422b3bd 100644
--- a/source/cChunkMap.cpp
+++ b/source/cChunkMap.cpp
@@ -287,11 +287,14 @@ void cChunkMap::cChunkLayer::Save(void)
void cChunkMap::cChunkLayer::UnloadUnusedChunks(void)
{
+ cWorld * World = m_Parent->GetWorld();
for (int i = 0; i < ARRAYCOUNT(m_Chunks); i++)
{
if ((m_Chunks[i] != NULL) && (m_Chunks[i]->CanUnload()))
{
// TODO: Save the chunk if it was changed
+ World->GetStorage().QueueSaveChunk(m_Chunks[i]); // _FT: FIXME: Right now it saves chunks even though it might not have changed.
+ // Also I'm not sure what's going on when I queue this chunks and the next line says reset the pointer.. =/
m_Chunks[i].reset();
}
} // for i - m_Chunks[]
diff --git a/source/cChunkMap.h b/source/cChunkMap.h
index bc7bddd96..b5d6abd60 100644
--- a/source/cChunkMap.h
+++ b/source/cChunkMap.h
@@ -84,7 +84,14 @@ private:
int GetX(void) const {return m_LayerX; }
int GetZ(void) const {return m_LayerZ; }
- int GetNumChunksLoaded(void) const {return m_NumChunksLoaded; }
+ int GetNumChunksLoaded(void) const
+ {
+ int NumChunks = 0;
+ for( int i = 0; i < LAYER_SIZE*LAYER_SIZE; ++i )
+ if( m_Chunks[i].get() )
+ NumChunks++;
+ return NumChunks;
+ }
void Save(void);
void UnloadUnusedChunks(void);