From 9cebc9157cf43ba639227b9d79b980b3613dda1e Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Mon, 10 Feb 2014 22:47:10 +0100 Subject: 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. --- src/ChunkStay.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/ChunkStay.cpp') diff --git a/src/ChunkStay.cpp b/src/ChunkStay.cpp index cce8d5f4d..6b1d5ee34 100644 --- a/src/ChunkStay.cpp +++ b/src/ChunkStay.cpp @@ -105,7 +105,7 @@ void cChunkStay::Disable(void) -void cChunkStay::ChunkAvailable(int a_ChunkX, int a_ChunkZ) +bool cChunkStay::ChunkAvailable(int a_ChunkX, int a_ChunkZ) { // Check if this is a chunk that we want: bool IsMine = false; @@ -120,15 +120,16 @@ void cChunkStay::ChunkAvailable(int a_ChunkX, int a_ChunkZ) } // for itr - m_OutstandingChunks[] if (!IsMine) { - return; + return false; } // Call the appropriate callbacks: OnChunkAvailable(a_ChunkX, a_ChunkZ); if (m_OutstandingChunks.empty()) { - OnAllChunksAvailable(); + return OnAllChunksAvailable(); } + return false; } -- cgit v1.2.3