summaryrefslogtreecommitdiffstats
path: root/source/cChunk.inl.h
diff options
context:
space:
mode:
authorfaketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-03-03 21:55:16 +0100
committerfaketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-03-03 21:55:16 +0100
commitad89cf88ba997651257412594cdd88e84a525a19 (patch)
tree7706bc9b0b9ae25cbb4b2b097e3c27bed5ba2e30 /source/cChunk.inl.h
parentThat should not have been committed... (diff)
downloadcuberite-ad89cf88ba997651257412594cdd88e84a525a19.tar
cuberite-ad89cf88ba997651257412594cdd88e84a525a19.tar.gz
cuberite-ad89cf88ba997651257412594cdd88e84a525a19.tar.bz2
cuberite-ad89cf88ba997651257412594cdd88e84a525a19.tar.lz
cuberite-ad89cf88ba997651257412594cdd88e84a525a19.tar.xz
cuberite-ad89cf88ba997651257412594cdd88e84a525a19.tar.zst
cuberite-ad89cf88ba997651257412594cdd88e84a525a19.zip
Diffstat (limited to 'source/cChunk.inl.h')
-rw-r--r--source/cChunk.inl.h8
1 files changed, 4 insertions, 4 deletions
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