From d8c8d0124da12587bbaf52992f7a8d2e0b010544 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Thu, 20 Aug 2020 20:04:28 +0100 Subject: Replace PowerData struct with PowerLevel * We no longer need to track the powering block with the removal of SolidBlockHandler. PowerLevel is now just an unsigned char --- .../IncrementalRedstoneSimulator/TripwireHookHandler.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/Simulator/IncrementalRedstoneSimulator/TripwireHookHandler.h') diff --git a/src/Simulator/IncrementalRedstoneSimulator/TripwireHookHandler.h b/src/Simulator/IncrementalRedstoneSimulator/TripwireHookHandler.h index 87853b254..63f9a5da7 100644 --- a/src/Simulator/IncrementalRedstoneSimulator/TripwireHookHandler.h +++ b/src/Simulator/IncrementalRedstoneSimulator/TripwireHookHandler.h @@ -60,7 +60,7 @@ namespace TripwireHookHandler return 0; } - inline unsigned char GetPowerDeliveredToPosition(const cChunk & a_Chunk, Vector3i a_Position, BLOCKTYPE a_BlockType, Vector3i a_QueryPosition, BLOCKTYPE a_QueryBlockType, bool IsLinked) + inline PowerLevel GetPowerDeliveredToPosition(const cChunk & a_Chunk, Vector3i a_Position, BLOCKTYPE a_BlockType, Vector3i a_QueryPosition, BLOCKTYPE a_QueryBlockType, bool IsLinked) { UNUSED(a_BlockType); UNUSED(a_QueryBlockType); @@ -69,22 +69,22 @@ namespace TripwireHookHandler return (GetPowerLevel(a_Chunk, a_Position, a_Chunk.GetMeta(a_Position)) == 15) ? 15 : 0; } - inline void Update(cChunk & a_Chunk, cChunk & CurrentlyTicking, Vector3i a_Position, BLOCKTYPE a_BlockType, NIBBLETYPE a_Meta, PoweringData a_PoweringData) + inline void Update(cChunk & a_Chunk, cChunk & CurrentlyTicking, Vector3i a_Position, BLOCKTYPE a_BlockType, NIBBLETYPE a_Meta, const PowerLevel Power) { // LOGD("Evaluating hooky the tripwire hook (%d %d %d)", a_Position.x, a_Position.y, a_Position.z); - const auto Power = GetPowerLevel(a_Chunk, a_Position, a_Meta); + const auto PowerLevel = GetPowerLevel(a_Chunk, a_Position, a_Meta); NIBBLETYPE Meta; - if (Power == 0) + if (PowerLevel == 0) { Meta = (a_Meta & 0x3); } - else if (Power == 1) + else if (PowerLevel == 1) { // Connected but not activated, AND away the highest bit Meta = (a_Meta & 0x7) | 0x4; } - else if (Power == 15) + else if (PowerLevel == 15) { // Connected and activated, set the 3rd and 4th highest bits Meta = (a_Meta | 0xC); -- cgit v1.2.3