diff options
author | Mattes D <github@xoft.cz> | 2014-01-26 14:13:54 +0100 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2014-01-26 14:13:54 +0100 |
commit | 09ee8a1bb66106823bf16b658b9942a9ec936db9 (patch) | |
tree | 4bf5ee54c2b13adc1582d4c4af85088d0a6831d7 /src/Blocks | |
parent | Merge pull request #590 from mc-server/Wolf_Fix (diff) | |
parent | Reduced unnecessary echoes (thanks xoft) (diff) | |
download | cuberite-09ee8a1bb66106823bf16b658b9942a9ec936db9.tar cuberite-09ee8a1bb66106823bf16b658b9942a9ec936db9.tar.gz cuberite-09ee8a1bb66106823bf16b658b9942a9ec936db9.tar.bz2 cuberite-09ee8a1bb66106823bf16b658b9942a9ec936db9.tar.lz cuberite-09ee8a1bb66106823bf16b658b9942a9ec936db9.tar.xz cuberite-09ee8a1bb66106823bf16b658b9942a9ec936db9.tar.zst cuberite-09ee8a1bb66106823bf16b658b9942a9ec936db9.zip |
Diffstat (limited to 'src/Blocks')
-rw-r--r-- | src/Blocks/BlockRail.h | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/src/Blocks/BlockRail.h b/src/Blocks/BlockRail.h index 55cadfa48..da3783d08 100644 --- a/src/Blocks/BlockRail.h +++ b/src/Blocks/BlockRail.h @@ -186,25 +186,35 @@ public: } if (RailsCnt > 1) { - if (Neighbors[3] && Neighbors[0]) return E_META_RAIL_CURVED_ZP_XP; - else if (Neighbors[3] && Neighbors[1]) return E_META_RAIL_CURVED_ZP_XM; - else if (Neighbors[2] && Neighbors[0]) return E_META_RAIL_CURVED_ZM_XP; - else if (Neighbors[2] && Neighbors[1]) return E_META_RAIL_CURVED_ZM_XM; + if (Neighbors[3] && Neighbors[0] && CanThisRailCurve()) return E_META_RAIL_CURVED_ZP_XP; + else if (Neighbors[3] && Neighbors[1] && CanThisRailCurve()) return E_META_RAIL_CURVED_ZP_XM; + else if (Neighbors[2] && Neighbors[0] && CanThisRailCurve()) return E_META_RAIL_CURVED_ZM_XP; + else if (Neighbors[2] && Neighbors[1] && CanThisRailCurve()) return E_META_RAIL_CURVED_ZM_XM; else if (Neighbors[7] && Neighbors[2]) return E_META_RAIL_ASCEND_ZP; else if (Neighbors[3] && Neighbors[6]) return E_META_RAIL_ASCEND_ZM; else if (Neighbors[5] && Neighbors[0]) return E_META_RAIL_ASCEND_XM; else if (Neighbors[4] && Neighbors[1]) return E_META_RAIL_ASCEND_XP; else if (Neighbors[0] && Neighbors[1]) return E_META_RAIL_XM_XP; else if (Neighbors[2] && Neighbors[3]) return E_META_RAIL_ZM_ZP; - ASSERT(!"Weird neighbor count"); + + if (CanThisRailCurve()) + { + ASSERT(!"Weird neighbor count"); + } } return Meta; } + inline bool CanThisRailCurve(void) + { + return m_BlockType == E_BLOCK_RAIL; + } + + 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 +349,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; } |