diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/LightingThread.cpp | 6 | ||||
-rw-r--r-- | source/LightingThread.h | 7 |
2 files changed, 9 insertions, 4 deletions
diff --git a/source/LightingThread.cpp b/source/LightingThread.cpp index 7c9529298..94648164e 100644 --- a/source/LightingThread.cpp +++ b/source/LightingThread.cpp @@ -474,7 +474,7 @@ void cLightingThread::CalcLightStep( int SeedY = SeedIdx / BlocksPerYLayer; // Propagate seed: - if (SeedX < cChunkDef::Width * 3) + if (SeedX < cChunkDef::Width * 3 - 1) { PropagateLight(a_Light, SeedIdx, SeedIdx + 1, NumSeedsOut, a_IsSeedOut, a_SeedIdxOut); } @@ -482,7 +482,7 @@ void cLightingThread::CalcLightStep( { PropagateLight(a_Light, SeedIdx, SeedIdx - 1, NumSeedsOut, a_IsSeedOut, a_SeedIdxOut); } - if (SeedZ < cChunkDef::Width * 3) + if (SeedZ < cChunkDef::Width * 3 - 1) { PropagateLight(a_Light, SeedIdx, SeedIdx + cChunkDef::Width * 3, NumSeedsOut, a_IsSeedOut, a_SeedIdxOut); } @@ -490,7 +490,7 @@ void cLightingThread::CalcLightStep( { PropagateLight(a_Light, SeedIdx, SeedIdx - cChunkDef::Width * 3, NumSeedsOut, a_IsSeedOut, a_SeedIdxOut); } - if (SeedY < cChunkDef::Height) + if (SeedY < cChunkDef::Height - 1) { PropagateLight(a_Light, SeedIdx, SeedIdx + cChunkDef::Width * cChunkDef::Width * 3 * 3, NumSeedsOut, a_IsSeedOut, a_SeedIdxOut); } diff --git a/source/LightingThread.h b/source/LightingThread.h index a19bc548e..498755025 100644 --- a/source/LightingThread.h +++ b/source/LightingThread.h @@ -146,7 +146,7 @@ protected: int & a_NumSeedsOut, unsigned char * a_IsSeedOut, unsigned int * a_SeedIdxOut ); - /// Compresses from 1-byte-per-block into 2-bytes-per-block: + /// Compresses from 1-block-per-byte (faster calc) into 2-blocks-per-byte (MC storage): void CompressLight(NIBBLETYPE * a_LightArray, NIBBLETYPE * a_ChunkLight); inline void PropagateLight( @@ -155,6 +155,11 @@ protected: int & a_NumSeedsOut, unsigned char * a_IsSeedOut, unsigned int * a_SeedIdxOut ) { + ASSERT(a_SrcIdx >= 0); + ASSERT(a_SrcIdx < ARRAYCOUNT(m_SkyLight)); + ASSERT(a_DstIdx >= 0); + ASSERT(a_DstIdx < ARRAYCOUNT(m_BlockTypes)); + if (a_Light[a_SrcIdx] <= a_Light[a_DstIdx] + g_BlockSpreadLightFalloff[m_BlockTypes[a_DstIdx]]) { // We're not offering more light than the dest block already has |