From ad89cf88ba997651257412594cdd88e84a525a19 Mon Sep 17 00:00:00 2001 From: faketruth Date: Sat, 3 Mar 2012 20:55:16 +0000 Subject: Got rid of some hardcoded numbers, now using hardcoded variables! woo git-svn-id: http://mc-server.googlecode.com/svn/trunk@355 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/cChunk.inl.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source/cChunk.inl.h') diff --git a/source/cChunk.inl.h b/source/cChunk.inl.h index 36a116e75..36643a87c 100644 --- a/source/cChunk.inl.h +++ b/source/cChunk.inl.h @@ -35,9 +35,9 @@ char cChunk::GetLight(char* a_Buffer, int a_BlockIdx) __C_CHUNK_INLINE__ char cChunk::GetLight(char* a_Buffer, int x, int y, int z) { - if( x < 16 && x > -1 && y < 128 && y > -1 && z < 16 && z > -1 ) + if( x < c_ChunkWidth && x > -1 && y < c_ChunkHeight && y > -1 && z < c_ChunkWidth && z > -1 ) { - const int cindex = (y/2) + (z * 64) + (x * 64 * 16); + const int cindex = (y/2) + (z * (c_ChunkHeight/2)) + (x * (c_ChunkHeight/2) * c_ChunkWidth); if( (y & 1) == 0 ) { // First half byte return (a_Buffer[cindex] & 0x0f); @@ -81,9 +81,9 @@ void cChunk::SetLight(char* a_Buffer, int a_BlockIdx, char a_Light) __C_CHUNK_INLINE__ void cChunk::SetLight(char* a_Buffer, int x, int y, int z, char light) { - if( x < 16 && x > -1 && y < 128 && y > -1 && z < 16 && z > -1 ) + if( x < c_ChunkWidth && x > -1 && y < c_ChunkHeight && y > -1 && z < c_ChunkWidth && z > -1 ) { - int cindex = (y/2) + (z * 64) + (x * 64 * 16); + int cindex = (y/2) + (z * (c_ChunkHeight/2)) + (x * (c_ChunkHeight/2) * c_ChunkWidth); if( (y & 1) == 0 ) { // First half byte a_Buffer[cindex] &= 0xf0; // Set first half to 0 -- cgit v1.2.3