summaryrefslogtreecommitdiffstats
path: root/source/cChunk.inl.h
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/cChunk.inl.h
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/cChunk.inl.h')
-rw-r--r--source/cChunk.inl.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/source/cChunk.inl.h b/source/cChunk.inl.h
index 4301f0486..0f0c25c09 100644
--- a/source/cChunk.inl.h
+++ b/source/cChunk.inl.h
@@ -38,7 +38,11 @@ char cChunk::GetNibble(char* a_Buffer, int x, int y, int z)
if( x < c_ChunkWidth && x > -1 && y < c_ChunkHeight && y > -1 && z < c_ChunkWidth && z > -1 )
{
const int cindex = MakeIndexNoCheck(x, y, z)/2;
+#if AXIS_ORDER == AXIS_ORDER_XZY
+ if( (x & 1) == 0 )
+#else if AXIS_ORDER == AXIS_ORDER_YZX
if( (y & 1) == 0 )
+#endif
{ // First half byte
return (a_Buffer[cindex] & 0x0f);
}
@@ -83,7 +87,11 @@ void cChunk::SetNibble(char* a_Buffer, int x, int y, int z, char light)
if( x < c_ChunkWidth && x > -1 && y < c_ChunkHeight && y > -1 && z < c_ChunkWidth && z > -1 )
{
int cindex = MakeIndexNoCheck(x, y, z)/2;
+#if AXIS_ORDER == AXIS_ORDER_XZY
+ if( (x & 1) == 0 )
+#else if AXIS_ORDER == AXIS_ORDER_YZX
if( (y & 1) == 0 )
+#endif
{ // First half byte
a_Buffer[cindex] &= 0xf0; // Set first half to 0
a_Buffer[cindex] |= (light) & 0x0f;