diff options
author | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2014-12-13 13:11:01 +0100 |
---|---|---|
committer | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2014-12-13 13:11:01 +0100 |
commit | 4b20a615192baeb5ef0a04a10161a03428cda8cd (patch) | |
tree | c6f25102267b0cc4a444f6e746679405948142b0 /src/LightingThread.cpp | |
parent | Fixed compilation? (diff) | |
parent | Merge pull request #1660 from Seadragon91/master (diff) | |
download | cuberite-4b20a615192baeb5ef0a04a10161a03428cda8cd.tar cuberite-4b20a615192baeb5ef0a04a10161a03428cda8cd.tar.gz cuberite-4b20a615192baeb5ef0a04a10161a03428cda8cd.tar.bz2 cuberite-4b20a615192baeb5ef0a04a10161a03428cda8cd.tar.lz cuberite-4b20a615192baeb5ef0a04a10161a03428cda8cd.tar.xz cuberite-4b20a615192baeb5ef0a04a10161a03428cda8cd.tar.zst cuberite-4b20a615192baeb5ef0a04a10161a03428cda8cd.zip |
Diffstat (limited to 'src/LightingThread.cpp')
-rw-r--r-- | src/LightingThread.cpp | 14 |
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; } |