diff options
Diffstat (limited to 'src/ChunkMap.cpp')
-rw-r--r-- | src/ChunkMap.cpp | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/ChunkMap.cpp b/src/ChunkMap.cpp index 7c4162b25..a16b08f15 100644 --- a/src/ChunkMap.cpp +++ b/src/ChunkMap.cpp @@ -2704,11 +2704,28 @@ void cChunkMap::SaveAllChunks(void) -int cChunkMap::GetNumChunks(void) +size_t cChunkMap::GetNumChunks(void) { cCSLock Lock(m_CSChunks); - return static_cast<int>(m_Chunks.size()); // TODO: change return value to unsigned type + return m_Chunks.size(); +} + + + + +size_t cChunkMap::GetNumUnusedDirtyChunks(void) +{ + cCSLock Lock(m_CSChunks); + size_t res = 0; + for (const auto & Chunk : m_Chunks) + { + if (Chunk.second->IsValid() && Chunk.second->CanUnloadAfterSaving()) + { + res += 1; + } + } + return res; } |