From 40eba5244ddd7045a9c3539c5f46c9921301ed90 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Sat, 8 Aug 2020 18:22:16 +0100 Subject: Remove the redstone solid block handler - Remove cSolidBlockHandler * Functionality now integrated into simulator dispatcher * Fix door double open/close issues, arisen due to the top/bottom halves getting different power + Small migration to block states for redstone wire --- .../IncrementalRedstoneSimulator/PoweredRailHandler.h | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'src/Simulator/IncrementalRedstoneSimulator/PoweredRailHandler.h') diff --git a/src/Simulator/IncrementalRedstoneSimulator/PoweredRailHandler.h b/src/Simulator/IncrementalRedstoneSimulator/PoweredRailHandler.h index 9e58e09ad..6f8dbc196 100644 --- a/src/Simulator/IncrementalRedstoneSimulator/PoweredRailHandler.h +++ b/src/Simulator/IncrementalRedstoneSimulator/PoweredRailHandler.h @@ -9,8 +9,6 @@ class cPoweredRailHandler final : public cRedstoneHandler { -public: - static Vector3i GetPoweredRailAdjacentXZCoordinateOffset(NIBBLETYPE a_Meta) // Not in cBlockRailHandler since specific to powered rails { switch (a_Meta & 0x7) @@ -29,11 +27,12 @@ public: } } - virtual unsigned char GetPowerDeliveredToPosition(cChunk & a_Chunk, Vector3i a_Position, BLOCKTYPE a_BlockType, NIBBLETYPE a_Meta, Vector3i a_QueryPosition, BLOCKTYPE a_QueryBlockType) const override + virtual unsigned char GetPowerDeliveredToPosition(const cChunk & a_Chunk, Vector3i a_Position, BLOCKTYPE a_BlockType, Vector3i a_QueryPosition, BLOCKTYPE a_QueryBlockType, bool IsLinked) const override { UNUSED(a_QueryBlockType); - auto Offset = GetPoweredRailAdjacentXZCoordinateOffset(a_Meta); + const auto Meta = a_Chunk.GetMeta(a_Position); + const auto Offset = GetPoweredRailAdjacentXZCoordinateOffset(Meta); if (((Offset + a_Position) == a_QueryPosition) || ((-Offset + a_Position) == a_QueryPosition)) { auto Power = DataForChunk(a_Chunk).GetCachedPowerData(a_Position).PowerLevel; @@ -66,8 +65,8 @@ public: { a_Chunk.SetMeta(a_Position, (a_PoweringData.PowerLevel == 0) ? (a_Meta & 0x07) : (a_Meta | 0x08)); - UpdateAdjustedRelative(a_Chunk, CurrentlyTickingChunk, a_Position + Offset); - UpdateAdjustedRelative(a_Chunk, CurrentlyTickingChunk, a_Position + -Offset); + UpdateAdjustedRelative(a_Chunk, CurrentlyTickingChunk, a_Position, Offset); + UpdateAdjustedRelative(a_Chunk, CurrentlyTickingChunk, a_Position, -Offset); } return; @@ -79,7 +78,7 @@ public: } } - virtual void ForValidSourcePositions(cChunk & a_Chunk, Vector3i a_Position, BLOCKTYPE a_BlockType, NIBBLETYPE a_Meta, SourceCallback Callback) const override + virtual void ForValidSourcePositions(const cChunk & a_Chunk, Vector3i a_Position, BLOCKTYPE a_BlockType, NIBBLETYPE a_Meta, SourceCallback Callback) const override { UNUSED(a_Chunk); UNUSED(a_Meta); -- cgit v1.2.3