summaryrefslogtreecommitdiffstats
path: root/src/Simulator/IncrementalRedstoneSimulator/ForEachSourceCallback.h
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@outlook.com>2020-08-08 19:22:16 +0200
committerTiger Wang <ziwei.tiger@outlook.com>2020-08-08 19:22:16 +0200
commit40eba5244ddd7045a9c3539c5f46c9921301ed90 (patch)
tree9edf40e2e5033ad19ce8a0739668500e30de653e /src/Simulator/IncrementalRedstoneSimulator/ForEachSourceCallback.h
parentconst-ify some Chunk functions (diff)
downloadcuberite-40eba5244ddd7045a9c3539c5f46c9921301ed90.tar
cuberite-40eba5244ddd7045a9c3539c5f46c9921301ed90.tar.gz
cuberite-40eba5244ddd7045a9c3539c5f46c9921301ed90.tar.bz2
cuberite-40eba5244ddd7045a9c3539c5f46c9921301ed90.tar.lz
cuberite-40eba5244ddd7045a9c3539c5f46c9921301ed90.tar.xz
cuberite-40eba5244ddd7045a9c3539c5f46c9921301ed90.tar.zst
cuberite-40eba5244ddd7045a9c3539c5f46c9921301ed90.zip
Diffstat (limited to 'src/Simulator/IncrementalRedstoneSimulator/ForEachSourceCallback.h')
-rw-r--r--src/Simulator/IncrementalRedstoneSimulator/ForEachSourceCallback.h32
1 files changed, 32 insertions, 0 deletions
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;
+};