summaryrefslogtreecommitdiffstats
path: root/src/ChunkMap.cpp
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2014-02-10 22:47:10 +0100
committermadmaxoft <github@xoft.cz>2014-02-10 22:47:10 +0100
commit9cebc9157cf43ba639227b9d79b980b3613dda1e (patch)
tree9c61bbee8a94668703c316f1c300187d247093f9 /src/ChunkMap.cpp
parentcLuaState: Stack traces don't include ghost 0-th element. (diff)
downloadcuberite-9cebc9157cf43ba639227b9d79b980b3613dda1e.tar
cuberite-9cebc9157cf43ba639227b9d79b980b3613dda1e.tar.gz
cuberite-9cebc9157cf43ba639227b9d79b980b3613dda1e.tar.bz2
cuberite-9cebc9157cf43ba639227b9d79b980b3613dda1e.tar.lz
cuberite-9cebc9157cf43ba639227b9d79b980b3613dda1e.tar.xz
cuberite-9cebc9157cf43ba639227b9d79b980b3613dda1e.tar.zst
cuberite-9cebc9157cf43ba639227b9d79b980b3613dda1e.zip
Diffstat (limited to 'src/ChunkMap.cpp')
-rw-r--r--src/ChunkMap.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/ChunkMap.cpp b/src/ChunkMap.cpp
index 7726a0b7e..0c5a8d9b9 100644
--- a/src/ChunkMap.cpp
+++ b/src/ChunkMap.cpp
@@ -912,9 +912,18 @@ void cChunkMap::SetChunkData(
}
// Notify relevant ChunkStays:
- for (cChunkStays::iterator itr = m_ChunkStays.begin(), end = m_ChunkStays.end(); itr != end; ++itr)
+ for (cChunkStays::iterator itr = m_ChunkStays.begin(); itr != m_ChunkStays.end(); )
{
- (*itr)->ChunkAvailable(a_ChunkX, a_ChunkZ);
+ if ((*itr)->ChunkAvailable(a_ChunkX, a_ChunkZ))
+ {
+ cChunkStays::iterator cur = itr;
+ ++itr;
+ m_ChunkStays.erase(cur);
+ }
+ else
+ {
+ ++itr;
+ }
} // for itr - m_ChunkStays[]
}