From fb7c60ec11fde185d30ae6cc59e8c85756f85b8f Mon Sep 17 00:00:00 2001 From: faketruth Date: Sun, 4 Mar 2012 13:54:33 +0000 Subject: Changed signed char to unsigned char in block packets, so we can receive height up to 255 Blocks placed above 128 limit don't become obsidian anymore. This was due to the cChunk::MakeIndex() function return 0 when outside of bounds, it now returns an 'error constant' git-svn-id: http://mc-server.googlecode.com/svn/trunk@356 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/Defines.h | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'source/Defines.h') diff --git a/source/Defines.h b/source/Defines.h index dcf4f0e0c..bd35ec3f4 100644 --- a/source/Defines.h +++ b/source/Defines.h @@ -55,8 +55,8 @@ inline bool IsBlockLava(char a_BlockID) return (a_BlockID == E_BLOCK_LAVA || a_BlockID == E_BLOCK_STATIONARY_LAVA); } -inline void AddDirection( int & a_X, char & a_Y, int & a_Z, char a_Direction, bool a_bInverse = false ) //tolua_export -{//tolua_export +inline void AddDirection( int & a_X, int & a_Y, int & a_Z, char a_Direction, bool a_bInverse = false ) +{ if( !a_bInverse ) { switch( a_Direction ) @@ -105,6 +105,15 @@ inline void AddDirection( int & a_X, char & a_Y, int & a_Z, char a_Direction, bo break; }; } +} + +inline void AddDirection( int & a_X, unsigned char & a_Y, int & a_Z, char a_Direction, bool a_bInverse = false ) //tolua_export +{//tolua_export + int Y = a_Y; + AddDirection( a_X, Y, a_Z, a_Direction, a_bInverse ); + if( Y < 0 ) a_Y = 0; + else if( Y > 255 ) a_Y = 255; + else a_Y = (unsigned char)Y; }//tolua_export #include -- cgit v1.2.3