From 055c9ef90ef8c9bb97a5f28ed5151899e1630e5e Mon Sep 17 00:00:00 2001 From: Marc_Bornand Date: Sat, 2 May 2020 22:15:46 +0200 Subject: Fix the connexion to the side of the repeater --- .../RedstoneWireHandler.h | 28 +++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) (limited to 'src/Simulator') diff --git a/src/Simulator/IncrementalRedstoneSimulator/RedstoneWireHandler.h b/src/Simulator/IncrementalRedstoneSimulator/RedstoneWireHandler.h index 32be166b1..752df4822 100644 --- a/src/Simulator/IncrementalRedstoneSimulator/RedstoneWireHandler.h +++ b/src/Simulator/IncrementalRedstoneSimulator/RedstoneWireHandler.h @@ -14,12 +14,34 @@ class cRedstoneWireHandler: public: - inline static bool IsDirectlyConnectingMechanism(BLOCKTYPE a_Block) + inline static bool IsDirectlyConnectingMechanism(cWorld & a_World, BLOCKTYPE a_Block, Vector3i a_QueryPosition, Vector3i a_Offset) { switch (a_Block) { case E_BLOCK_REDSTONE_REPEATER_ON: case E_BLOCK_REDSTONE_REPEATER_OFF: + if ((a_World.GetBlockMeta(a_QueryPosition) & 0x1) == 1) + { + if (a_Offset.x == 0) + { + return false; + } + else + { + return true; + } + } + else + { + if (a_Offset.z == 0) + { + return false; + } + else + { + return true; + } + } case E_BLOCK_ACTIVE_COMPARATOR: case E_BLOCK_INACTIVE_COMPARATOR: case E_BLOCK_REDSTONE_TORCH_OFF: @@ -72,14 +94,14 @@ public: a_Meta++; } - if ((a_QueryPosition != (a_Position + OffsetYM())) && !IsDirectlyConnectingMechanism(a_QueryBlockType)) + if ((a_QueryPosition != (a_Position + OffsetYM())) && !IsDirectlyConnectingMechanism(a_World, a_QueryBlockType, a_QueryPosition, a_QueryPosition - a_Position)) { Vector3i PotentialOffset; bool FoundOneBorderingMechanism = false; for (const auto & Offset : StaticAppend(GetRelativeLaterals(), GetTerracingConnectionOffsets(a_World, a_Position))) { - if (IsDirectlyConnectingMechanism(a_World.GetBlock(Offset + a_Position))) + if (IsDirectlyConnectingMechanism(a_World, a_World.GetBlock(Offset + a_Position), a_QueryPosition, Offset)) { if (FoundOneBorderingMechanism) { -- cgit v1.2.3