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 --- .../ForEachSourceCallback.h | 32 ++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/Simulator/IncrementalRedstoneSimulator/ForEachSourceCallback.h (limited to 'src/Simulator/IncrementalRedstoneSimulator/ForEachSourceCallback.h') diff --git a/src/Simulator/IncrementalRedstoneSimulator/ForEachSourceCallback.h b/src/Simulator/IncrementalRedstoneSimulator/ForEachSourceCallback.h new file mode 100644 index 000000000..4ab3866d3 --- /dev/null +++ b/src/Simulator/IncrementalRedstoneSimulator/ForEachSourceCallback.h @@ -0,0 +1,32 @@ + +#pragma once + +#include "ForEachSourceCallback.h" +#include "RedstoneSimulatorChunkData.h" + +class ForEachSourceCallback +{ +public: + + ForEachSourceCallback(const cChunk & Chunk, Vector3i Position, BLOCKTYPE CurrentBlock); + + /** Returns whether a potential source position should be treated as linked. */ + bool ShouldQueryLinkedPosition(Vector3i Location, BLOCKTYPE Block); + + /** Callback invoked for each potential source position of the redstone component. */ + void operator()(Vector3i Location); + + /** Asks a redstone component at the source position how much power it will deliver to the querying position. */ + static PoweringData QueryPower(const cChunk & Chunk, Vector3i SourcePosition, BLOCKTYPE SourceBlock, Vector3i QueryPosition, BLOCKTYPE QueryBlock, bool IsLinked); + + /** Asks redstone handlers adjacent to a solid block how much power they will deliver to the querying position, via the solid block. */ + static PoweringData QueryLinkedPower(const cChunk & Chunk, Vector3i QueryPosition, BLOCKTYPE QueryBlock, Vector3i SolidBlockPosition); + + PoweringData Power; + +private: + + const cChunk & m_Chunk; + const Vector3i m_Position; + const BLOCKTYPE m_CurrentBlock; +}; -- cgit v1.2.3