1
0

Merge pull request #1357 from mc-server/leafFix

Check range of y in HasNearLog
This commit is contained in:
Mattes D 2014-08-31 12:27:56 +03:00
commit e9f9539310

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++)
{ {