summaryrefslogtreecommitdiffstats
path: root/source/Defines.h
diff options
context:
space:
mode:
authorfaketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-03-04 14:54:33 +0100
committerfaketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-03-04 14:54:33 +0100
commitfb7c60ec11fde185d30ae6cc59e8c85756f85b8f (patch)
tree842851c4f6561782c663144dd2f5bed8a441b511 /source/Defines.h
parentGot rid of some hardcoded numbers, now using hardcoded variables! woo (diff)
downloadcuberite-fb7c60ec11fde185d30ae6cc59e8c85756f85b8f.tar
cuberite-fb7c60ec11fde185d30ae6cc59e8c85756f85b8f.tar.gz
cuberite-fb7c60ec11fde185d30ae6cc59e8c85756f85b8f.tar.bz2
cuberite-fb7c60ec11fde185d30ae6cc59e8c85756f85b8f.tar.lz
cuberite-fb7c60ec11fde185d30ae6cc59e8c85756f85b8f.tar.xz
cuberite-fb7c60ec11fde185d30ae6cc59e8c85756f85b8f.tar.zst
cuberite-fb7c60ec11fde185d30ae6cc59e8c85756f85b8f.zip
Diffstat (limited to 'source/Defines.h')
-rw-r--r--source/Defines.h13
1 files changed, 11 insertions, 2 deletions
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 <math.h>