From e2a04f580a0813206f527a61244cb3382248fd12 Mon Sep 17 00:00:00 2001 From: Mattes D Date: Fri, 5 Dec 2014 16:59:11 +0100 Subject: BasicStyle: Added missing braces to control statements. --- src/Blocks/BlockRail.h | 88 +++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 72 insertions(+), 16 deletions(-) (limited to 'src/Blocks/BlockRail.h') diff --git a/src/Blocks/BlockRail.h b/src/Blocks/BlockRail.h index 87ce069ab..21a34d8ce 100644 --- a/src/Blocks/BlockRail.h +++ b/src/Blocks/BlockRail.h @@ -151,13 +151,21 @@ public: Neighbors[6] = (IsUnstable(a_ChunkInterface, a_BlockX, a_BlockY + 1, a_BlockZ - 1) || !IsNotConnected(a_ChunkInterface, a_BlockX, a_BlockY + 1, a_BlockZ, BLOCK_FACE_NORTH, E_PURE_NONE)); Neighbors[7] = (IsUnstable(a_ChunkInterface, a_BlockX, a_BlockY + 1, a_BlockZ + 1) || !IsNotConnected(a_ChunkInterface, a_BlockX, a_BlockY + 1, a_BlockZ, BLOCK_FACE_SOUTH, E_PURE_NONE)); if (IsUnstable(a_ChunkInterface, a_BlockX + 1, a_BlockY - 1, a_BlockZ) || !IsNotConnected(a_ChunkInterface, a_BlockX, a_BlockY - 1, a_BlockZ, BLOCK_FACE_EAST)) + { Neighbors[0] = true; + } if (IsUnstable(a_ChunkInterface, a_BlockX - 1, a_BlockY - 1, a_BlockZ) || !IsNotConnected(a_ChunkInterface, a_BlockX, a_BlockY - 1, a_BlockZ, BLOCK_FACE_WEST)) + { Neighbors[1] = true; + } if (IsUnstable(a_ChunkInterface, a_BlockX, a_BlockY - 1, a_BlockZ - 1) || !IsNotConnected(a_ChunkInterface, a_BlockX, a_BlockY - 1, a_BlockZ, BLOCK_FACE_NORTH)) + { Neighbors[2] = true; + } if (IsUnstable(a_ChunkInterface, a_BlockX, a_BlockY - 1, a_BlockZ + 1) || !IsNotConnected(a_ChunkInterface, a_BlockX, a_BlockY - 1, a_BlockZ, BLOCK_FACE_SOUTH)) + { Neighbors[3] = true; + } for (int i = 0; i < 8; i++) { if (Neighbors[i]) @@ -167,12 +175,30 @@ public: } if (RailsCnt == 1) { - if (Neighbors[7]) return E_META_RAIL_ASCEND_ZP; - else if (Neighbors[6]) return E_META_RAIL_ASCEND_ZM; - else if (Neighbors[5]) return E_META_RAIL_ASCEND_XM; - else if (Neighbors[4]) 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; + if (Neighbors[7]) + { + return E_META_RAIL_ASCEND_ZP; + } + else if (Neighbors[6]) + { + return E_META_RAIL_ASCEND_ZM; + } + else if (Neighbors[5]) + { + return E_META_RAIL_ASCEND_XM; + } + else if (Neighbors[4]) + { + 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"); return Meta; } @@ -185,16 +211,46 @@ public: } if (RailsCnt > 1) { - 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; + 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; + } if (CanThisRailCurve()) { -- cgit v1.2.3