From 43c9546203f7a90cfd88c80a4d508caea3938e06 Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Fri, 1 Jun 2012 06:25:30 +0000 Subject: Fixed a nasty int overflow bug in blockticking code ( http://forum.mc-server.org/showthread.php?tid=457 ) git-svn-id: http://mc-server.googlecode.com/svn/trunk@533 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/cChunk.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'source') diff --git a/source/cChunk.cpp b/source/cChunk.cpp index de8e3134c..c918c589e 100644 --- a/source/cChunk.cpp +++ b/source/cChunk.cpp @@ -519,9 +519,10 @@ void cChunk::Tick(float a_Dt, MTRand & a_TickRandom) void cChunk::TickBlocks(MTRand & a_TickRandom) { // Tick dem blocks - int RandomX = a_TickRandom.randInt(); - int RandomY = a_TickRandom.randInt(); - int RandomZ = a_TickRandom.randInt(); + // _X: We must limit the random number or else we get a nasty int overflow bug ( http://forum.mc-server.org/showthread.php?tid=457 ) + int RandomX = a_TickRandom.randInt(0x00ffffff); + int RandomY = a_TickRandom.randInt(0x00ffffff); + int RandomZ = a_TickRandom.randInt(0x00ffffff); int TickX = m_BlockTickX; int TickY = m_BlockTickY; int TickZ = m_BlockTickZ; -- cgit v1.2.3