summaryrefslogtreecommitdiffstats
path: root/source/cChunk.cpp
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-05-30 23:29:51 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-05-30 23:29:51 +0200
commit7af3df03a056667ffeef71b785f6633d3cff957b (patch)
treebd0294bd3f8158372958c102fa9b4ab3cf8a50d5 /source/cChunk.cpp
parentMelon and pumpkin stems now grow melons and pumpkins (diff)
downloadcuberite-7af3df03a056667ffeef71b785f6633d3cff957b.tar
cuberite-7af3df03a056667ffeef71b785f6633d3cff957b.tar.gz
cuberite-7af3df03a056667ffeef71b785f6633d3cff957b.tar.bz2
cuberite-7af3df03a056667ffeef71b785f6633d3cff957b.tar.lz
cuberite-7af3df03a056667ffeef71b785f6633d3cff957b.tar.xz
cuberite-7af3df03a056667ffeef71b785f6633d3cff957b.tar.zst
cuberite-7af3df03a056667ffeef71b785f6633d3cff957b.zip
Diffstat (limited to '')
-rw-r--r--source/cChunk.cpp30
1 files changed, 12 insertions, 18 deletions
diff --git a/source/cChunk.cpp b/source/cChunk.cpp
index 67ae02ecf..024e50adc 100644
--- a/source/cChunk.cpp
+++ b/source/cChunk.cpp
@@ -519,16 +519,6 @@ void cChunk::Tick(float a_Dt, MTRand & a_TickRandom)
void cChunk::TickBlocks(MTRand & a_TickRandom)
{
// Tick dem blocks
- /*
- // DEBUG:
- int RandomX = 0;
- int RandomY = 1;
- int RandomZ = 0;
- m_BlockTickX = 0;
- m_BlockTickY = 40;
- m_BlockTickZ = 0;
- */
-
int RandomX = a_TickRandom.randInt();
int RandomY = a_TickRandom.randInt();
int RandomZ = a_TickRandom.randInt();
@@ -536,17 +526,21 @@ void cChunk::TickBlocks(MTRand & a_TickRandom)
int TickY = m_BlockTickY;
int TickZ = m_BlockTickZ;
- for (int i = 0; i < 50; i++)
- {
+ // This for loop looks disgusting, but it actually does a simple thing - first processes m_BlockTick, then adds random to it
+ // This is so that SetNextBlockTick() works
+ for (int i = 0; i < 50; i++,
+
// This weird construct (*2, then /2) is needed,
// otherwise the blocktick distribution is too biased towards even coords!
- TickX = (TickX + RandomX) % (Width * 2);
- TickY = (TickY + RandomY) % (Height * 2);
- TickZ = (TickZ + RandomZ) % (Width * 2);
- m_BlockTickX = TickX / 2;
- m_BlockTickY = TickY / 2;
- m_BlockTickZ = TickZ / 2;
+ TickX = (TickX + RandomX) % (Width * 2),
+ TickY = (TickY + RandomY) % (Height * 2),
+ TickZ = (TickZ + RandomZ) % (Width * 2),
+ m_BlockTickX = TickX / 2,
+ m_BlockTickY = TickY / 2,
+ m_BlockTickZ = TickZ / 2
+ )
+ {
if (m_BlockTickY > cChunkDef::GetHeight(m_HeightMap, m_BlockTickX, m_BlockTickZ))
{