1
0

Rewritten Lua ChunkStay API into a single function, cWorld:ChunkStay().

This fixes problems with indeterminate class object lifespan (Lua-GC) and forgetting to disable it or keep it until ready.
This commit is contained in:
madmaxoft
2014-02-10 22:47:10 +01:00
parent 589a4839df
commit 9cebc9157c
9 changed files with 213 additions and 87 deletions

View File

@@ -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[]
}