diff options
author | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2014-01-19 15:52:45 +0100 |
---|---|---|
committer | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2014-01-19 15:52:45 +0100 |
commit | 8467f5dfaea596a0b7e294cf1b7dce224c41d7b9 (patch) | |
tree | 7e8579f17f71a22a5bc957a9712b629c55c870cc | |
parent | Merge remote-tracking branch 'origin/master' into minecartimprovements (diff) | |
download | cuberite-8467f5dfaea596a0b7e294cf1b7dce224c41d7b9.tar cuberite-8467f5dfaea596a0b7e294cf1b7dce224c41d7b9.tar.gz cuberite-8467f5dfaea596a0b7e294cf1b7dce224c41d7b9.tar.bz2 cuberite-8467f5dfaea596a0b7e294cf1b7dce224c41d7b9.tar.lz cuberite-8467f5dfaea596a0b7e294cf1b7dce224c41d7b9.tar.xz cuberite-8467f5dfaea596a0b7e294cf1b7dce224c41d7b9.tar.zst cuberite-8467f5dfaea596a0b7e294cf1b7dce224c41d7b9.zip |
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 { |