diff options
Diffstat (limited to '')
-rw-r--r-- | src/Blocks/BlockRail.h | 8 | ||||
-rw-r--r-- | src/Defines.h | 18 | ||||
-rw-r--r-- | src/Entities/Minecart.h | 14 |
3 files changed, 22 insertions, 18 deletions
diff --git a/src/Blocks/BlockRail.h b/src/Blocks/BlockRail.h index 55cadfa48..f13e987b7 100644 --- a/src/Blocks/BlockRail.h +++ b/src/Blocks/BlockRail.h @@ -204,7 +204,7 @@ public: bool IsUnstable(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ) { - if (a_World->GetBlock(a_BlockX, a_BlockY, a_BlockZ) != E_BLOCK_RAIL) + if (!IsBlockRail(a_World->GetBlock(a_BlockX, a_BlockY, a_BlockZ))) { return false; } @@ -339,11 +339,11 @@ public: { AddFaceDirection(a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, false); NIBBLETYPE Meta; - if (a_World->GetBlock(a_BlockX, a_BlockY, a_BlockZ) != E_BLOCK_RAIL) + if (!IsBlockRail(a_World->GetBlock(a_BlockX, a_BlockY, a_BlockZ))) { - if ((a_World->GetBlock(a_BlockX, a_BlockY + 1, a_BlockZ) != E_BLOCK_RAIL) || (a_Pure != E_PURE_UPDOWN)) + if (!IsBlockRail(a_World->GetBlock(a_BlockX, a_BlockY + 1, a_BlockZ)) || (a_Pure != E_PURE_UPDOWN)) { - if ((a_World->GetBlock(a_BlockX, a_BlockY - 1, a_BlockZ) != E_BLOCK_RAIL) || (a_Pure == E_PURE_NONE)) + if (!IsBlockRail(a_World->GetBlock(a_BlockX, a_BlockY - 1, a_BlockZ)) || (a_Pure == E_PURE_NONE)) { return true; } diff --git a/src/Defines.h b/src/Defines.h index 7a86f499e..298180fb1 100644 --- a/src/Defines.h +++ b/src/Defines.h @@ -282,6 +282,24 @@ inline bool IsBlockLiquid(BLOCKTYPE a_BlockType) +inline bool IsBlockRail(BLOCKTYPE a_BlockType) +{ + switch (a_BlockType) + { + case E_BLOCK_RAIL: + case E_BLOCK_ACTIVATOR_RAIL: + case E_BLOCK_DETECTOR_RAIL: + case E_BLOCK_POWERED_RAIL: + { + return true; + } + default: return false; + } +} + + + + inline bool IsBlockTypeOfDirt(BLOCKTYPE a_BlockType) { diff --git a/src/Entities/Minecart.h b/src/Entities/Minecart.h index a4ecb33ad..87f785538 100644 --- a/src/Entities/Minecart.h +++ b/src/Entities/Minecart.h @@ -15,20 +15,6 @@ -inline bool IsBlockRail(BLOCKTYPE a_BlockType) - { - return ( - (a_BlockType == E_BLOCK_RAIL) || - (a_BlockType == E_BLOCK_ACTIVATOR_RAIL) || - (a_BlockType == E_BLOCK_DETECTOR_RAIL) || - (a_BlockType == E_BLOCK_POWERED_RAIL) - ) ; - } - - - - - class cMinecart : public cEntity { |