summaryrefslogtreecommitdiffstats
path: root/src/LightingThread.cpp
diff options
context:
space:
mode:
authorHowaner <franzi.moos@googlemail.com>2014-12-13 20:10:23 +0100
committerHowaner <franzi.moos@googlemail.com>2014-12-13 20:10:23 +0100
commita595a4a842123f10a4b27ae082794bad0250a307 (patch)
treeb0f50e06e6f7a55a8d5a18cfb37a53234f527236 /src/LightingThread.cpp
parentAdded cocoa pod. (diff)
parentMerge pull request #1663 from mc-server/APIDumpSize (diff)
downloadcuberite-a595a4a842123f10a4b27ae082794bad0250a307.tar
cuberite-a595a4a842123f10a4b27ae082794bad0250a307.tar.gz
cuberite-a595a4a842123f10a4b27ae082794bad0250a307.tar.bz2
cuberite-a595a4a842123f10a4b27ae082794bad0250a307.tar.lz
cuberite-a595a4a842123f10a4b27ae082794bad0250a307.tar.xz
cuberite-a595a4a842123f10a4b27ae082794bad0250a307.tar.zst
cuberite-a595a4a842123f10a4b27ae082794bad0250a307.zip
Diffstat (limited to 'src/LightingThread.cpp')
-rw-r--r--src/LightingThread.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/LightingThread.cpp b/src/LightingThread.cpp
index ae5e746e7..ced95d4e1 100644
--- a/src/LightingThread.cpp
+++ b/src/LightingThread.cpp
@@ -226,6 +226,8 @@ void cLightingThread::Execute(void)
} // CSLock(m_CS)
LightChunk(*Item);
+ Item->Disable();
+ delete Item;
}
}
@@ -236,6 +238,16 @@ void cLightingThread::Execute(void)
void cLightingThread::LightChunk(cLightingChunkStay & a_Item)
{
+ // If the chunk is already lit, skip it:
+ if (m_World->IsChunkLighted(a_Item.m_ChunkX, a_Item.m_ChunkZ))
+ {
+ if (a_Item.m_CallbackAfter != nullptr)
+ {
+ a_Item.m_CallbackAfter->Call(a_Item.m_ChunkX, a_Item.m_ChunkZ);
+ }
+ return;
+ }
+
cChunkDef::BlockNibbles BlockLight, SkyLight;
ReadChunks(a_Item.m_ChunkX, a_Item.m_ChunkZ);
@@ -314,8 +326,6 @@ void cLightingThread::LightChunk(cLightingChunkStay & a_Item)
{
a_Item.m_CallbackAfter->Call(a_Item.m_ChunkX, a_Item.m_ChunkZ);
}
- a_Item.Disable();
- delete &a_Item;
}