summaryrefslogtreecommitdiffstats
path: root/source/cWorldGenerator.cpp
diff options
context:
space:
mode:
authorfaketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-03-10 03:39:36 +0100
committerfaketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-03-10 03:39:36 +0100
commit68f3ea56bdcf4664ee119016a0745d46f2c31a65 (patch)
treeedbf0523589e4a458c999c076c041ad61dcdb8b2 /source/cWorldGenerator.cpp
parentUsing more of the index functions in cChunk, so it should be easy enough to flip the axis ordering now (diff)
downloadcuberite-68f3ea56bdcf4664ee119016a0745d46f2c31a65.tar
cuberite-68f3ea56bdcf4664ee119016a0745d46f2c31a65.tar.gz
cuberite-68f3ea56bdcf4664ee119016a0745d46f2c31a65.tar.bz2
cuberite-68f3ea56bdcf4664ee119016a0745d46f2c31a65.tar.lz
cuberite-68f3ea56bdcf4664ee119016a0745d46f2c31a65.tar.xz
cuberite-68f3ea56bdcf4664ee119016a0745d46f2c31a65.tar.zst
cuberite-68f3ea56bdcf4664ee119016a0745d46f2c31a65.zip
Diffstat (limited to 'source/cWorldGenerator.cpp')
-rw-r--r--source/cWorldGenerator.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/source/cWorldGenerator.cpp b/source/cWorldGenerator.cpp
index 2dfd3a8ee..6884d80b3 100644
--- a/source/cWorldGenerator.cpp
+++ b/source/cWorldGenerator.cpp
@@ -201,7 +201,7 @@ unsigned int cWorldGenerator::MakeIndex(int x, int y, int z )
{
ASSERT((x < cChunk::c_ChunkWidth) && (x > -1) && (y < cChunk::c_ChunkHeight) && (y > -1) && (z < cChunk::c_ChunkWidth) && (z > -1));
- return y + (z * cChunk::c_ChunkHeight) + (x * cChunk::c_ChunkHeight * cChunk::c_ChunkWidth);
+ return cChunk::MakeIndexNoCheck( x, y, z );
}
@@ -433,7 +433,7 @@ void cWorldGenerator::GenerateFoliage(int a_ChunkX, int a_ChunkY, int a_ChunkZ)
int xx = x + a_ChunkX * cChunk::c_ChunkWidth;
int TopY = m_World->GetHeight(xx, zz);
- int index = MakeIndex(x, TopY - 1, z);
+ int index = cChunk::MakeIndexNoCheck(x, MAX(TopY - 1, 0), z);
if (BlockType[index] == BLOCK_GRASS)
{
float val1 = Noise.CubicNoise2D( xx * 0.1f, zz * 0.1f );