summaryrefslogtreecommitdiffstats
path: root/source/Defines.h
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-08-10 22:42:59 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-08-10 22:42:59 +0200
commit897733a58e595ec94d93c81e0f7f07e577d89a04 (patch)
tree3b0d71138a3753ff9ed8fe768292f39a5479eb44 /source/Defines.h
parentFixed cacti and sugarcane not being placeable on themselves (FS #234, patch submitted by STR_Warrior) (diff)
downloadcuberite-897733a58e595ec94d93c81e0f7f07e577d89a04.tar
cuberite-897733a58e595ec94d93c81e0f7f07e577d89a04.tar.gz
cuberite-897733a58e595ec94d93c81e0f7f07e577d89a04.tar.bz2
cuberite-897733a58e595ec94d93c81e0f7f07e577d89a04.tar.lz
cuberite-897733a58e595ec94d93c81e0f7f07e577d89a04.tar.xz
cuberite-897733a58e595ec94d93c81e0f7f07e577d89a04.tar.zst
cuberite-897733a58e595ec94d93c81e0f7f07e577d89a04.zip
Diffstat (limited to '')
-rw-r--r--source/Defines.h80
1 files changed, 40 insertions, 40 deletions
diff --git a/source/Defines.h b/source/Defines.h
index 08ee877b7..fb856b835 100644
--- a/source/Defines.h
+++ b/source/Defines.h
@@ -19,6 +19,20 @@ extern bool g_BlockOneHitDig[];
+enum
+{
+ BLOCK_FACE_BOTTOM = 0, // Interacting with the bottom face of the block
+ BLOCK_FACE_TOP = 1, // Interacting with the top face of the block
+ BLOCK_FACE_EAST = 2, // Interacting with the eastern face of the block
+ BLOCK_FACE_WEST = 3, // Interacting with the western face of the block
+ BLOCK_FACE_NORTH = 4, // Interacting with the northern face of the block
+ BLOCK_FACE_SOUTH = 5, // Interacting with the southern face of the block
+} ;
+
+
+
+
+
inline bool IsValidBlock( int a_BlockID ) //tolua_export
{ //tolua_export
if( a_BlockID > -1 &&
@@ -94,53 +108,39 @@ inline bool IsBlockTypeOfDirt(char a_BlockID)
inline void AddDirection( int & a_X, int & a_Y, int & a_Z, char a_Direction, bool a_bInverse = false )
{
- if( !a_bInverse )
+ if (!a_bInverse)
{
- switch( a_Direction )
+ switch (a_Direction)
{
- case 0:
- a_Y--;
- break;
- case 1:
- a_Y++;
- break;
- case 2:
- a_Z--;
- break;
- case 3:
- a_Z++;
- break;
- case 4:
- a_X--;
- break;
- case 5:
- a_X++;
- break;
- };
+ case BLOCK_FACE_BOTTOM: a_Y--; break;
+ case BLOCK_FACE_TOP: a_Y++; break;
+ case BLOCK_FACE_EAST: a_Z--; break;
+ case BLOCK_FACE_WEST: a_Z++; break;
+ case BLOCK_FACE_NORTH: a_X--; break;
+ case BLOCK_FACE_SOUTH: a_X++; break;
+ default:
+ {
+ ASSERT(!"Unknown direction");
+ break;
+ }
+ }
}
else
{
switch( a_Direction ) // other way around
{
- case 0:
- a_Y++;
- break;
- case 1:
- a_Y--;
- break;
- case 2:
- a_Z++;
- break;
- case 3:
- a_Z--;
- break;
- case 4:
- a_X++;
- break;
- case 5:
- a_X--;
- break;
- };
+ case BLOCK_FACE_BOTTOM: a_Y++; break;
+ case BLOCK_FACE_TOP: a_Y--; break;
+ case BLOCK_FACE_EAST: a_Z++; break;
+ case BLOCK_FACE_WEST: a_Z--; break;
+ case BLOCK_FACE_NORTH: a_X++; break;
+ case BLOCK_FACE_SOUTH: a_X--; break;
+ default:
+ {
+ ASSERT(!"Unknown direction");
+ break;
+ }
+ }
}
}