diff options
author | LogicParrot <LogicParrot@users.noreply.github.com> | 2016-09-03 17:38:29 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-09-03 17:38:29 +0200 |
commit | 7e9e7f79110e398a4d2b07de3093eaccd551f013 (patch) | |
tree | 96098b99f146a40f42c4322d96fcd061b9548d8a /src/ChunkMap.cpp | |
parent | Entities now bail out of ticks if destroyed (#3363) (diff) | |
download | cuberite-7e9e7f79110e398a4d2b07de3093eaccd551f013.tar cuberite-7e9e7f79110e398a4d2b07de3093eaccd551f013.tar.gz cuberite-7e9e7f79110e398a4d2b07de3093eaccd551f013.tar.bz2 cuberite-7e9e7f79110e398a4d2b07de3093eaccd551f013.tar.lz cuberite-7e9e7f79110e398a4d2b07de3093eaccd551f013.tar.xz cuberite-7e9e7f79110e398a4d2b07de3093eaccd551f013.tar.zst cuberite-7e9e7f79110e398a4d2b07de3093eaccd551f013.zip |
Diffstat (limited to '')
-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; } |