1
0

Fixed crashes caused LightingThread overwriting memory where it shouldn't (yay valgrind!)

git-svn-id: http://mc-server.googlecode.com/svn/trunk@1046 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
madmaxoft@gmail.com
2012-11-16 09:40:15 +00:00
parent ea8545dff1
commit c360d683e0
2 changed files with 9 additions and 4 deletions

View File

@@ -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);
}