1
0

Check range of y in HasNearLog

Fixes #803
This commit is contained in:
worktycho 2014-08-31 00:15:48 +01:00
parent 9f321e29cf
commit 365d2447d0

View File

@ -152,7 +152,7 @@ bool HasNearLog(cBlockArea & a_Area, int a_BlockX, int a_BlockY, int a_BlockZ)
a_Area.SetBlockType(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_SPONGE); a_Area.SetBlockType(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_SPONGE);
for (int i = 0; i < LEAVES_CHECK_DISTANCE; i++) for (int i = 0; i < LEAVES_CHECK_DISTANCE; i++)
{ {
for (int y = a_BlockY - i; y <= a_BlockY + i; y++) for (int y = std::max(a_BlockY - i, 0); y <= std::min(a_BlockY + i, 255); y++)
{ {
for (int z = a_BlockZ - i; z <= a_BlockZ + i; z++) for (int z = a_BlockZ - i; z <= a_BlockZ + i; z++)
{ {