From 62ba8f5a207acb3b7fddbc790c45b01447cfe58f Mon Sep 17 00:00:00 2001 From: faketruth Date: Sat, 10 Mar 2012 00:25:05 +0000 Subject: Using more of the index functions in cChunk, so it should be easy enough to flip the axis ordering now Added some more functions that use Vector3i for block coordinates in cChunk git-svn-id: http://mc-server.googlecode.com/svn/trunk@389 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/cChunk.inl.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source/cChunk.inl.h') diff --git a/source/cChunk.inl.h b/source/cChunk.inl.h index 16d1855dd..4301f0486 100644 --- a/source/cChunk.inl.h +++ b/source/cChunk.inl.h @@ -37,7 +37,7 @@ 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 = (y/2) + (z * (c_ChunkHeight/2)) + (x * (c_ChunkHeight/2) * c_ChunkWidth); + const int cindex = MakeIndexNoCheck(x, y, z)/2; if( (y & 1) == 0 ) { // First half byte return (a_Buffer[cindex] & 0x0f); @@ -82,7 +82,7 @@ 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 = (y/2) + (z * (c_ChunkHeight/2)) + (x * (c_ChunkHeight/2) * c_ChunkWidth); + int cindex = MakeIndexNoCheck(x, y, z)/2; if( (y & 1) == 0 ) { // First half byte a_Buffer[cindex] &= 0xf0; // Set first half to 0 -- cgit v1.2.3