summaryrefslogtreecommitdiffstats
path: root/src/Simulator/IncrementalRedstoneSimulator/ObserverHandler.h
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@outlook.com>2020-08-19 22:14:40 +0200
committerTiger Wang <ziwei.tiger@outlook.com>2020-08-21 01:50:09 +0200
commit3143d6ce679f322ee73d3d70e2d843e9c98cc043 (patch)
tree8ccc3b6d2a22a848e0c01c667aa10b25c3a5684e /src/Simulator/IncrementalRedstoneSimulator/ObserverHandler.h
parentMinor typo fixes (diff)
downloadcuberite-3143d6ce679f322ee73d3d70e2d843e9c98cc043.tar
cuberite-3143d6ce679f322ee73d3d70e2d843e9c98cc043.tar.gz
cuberite-3143d6ce679f322ee73d3d70e2d843e9c98cc043.tar.bz2
cuberite-3143d6ce679f322ee73d3d70e2d843e9c98cc043.tar.lz
cuberite-3143d6ce679f322ee73d3d70e2d843e9c98cc043.tar.xz
cuberite-3143d6ce679f322ee73d3d70e2d843e9c98cc043.tar.zst
cuberite-3143d6ce679f322ee73d3d70e2d843e9c98cc043.zip
Diffstat (limited to 'src/Simulator/IncrementalRedstoneSimulator/ObserverHandler.h')
-rw-r--r--src/Simulator/IncrementalRedstoneSimulator/ObserverHandler.h13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/Simulator/IncrementalRedstoneSimulator/ObserverHandler.h b/src/Simulator/IncrementalRedstoneSimulator/ObserverHandler.h
index c0866824b..926b3ab51 100644
--- a/src/Simulator/IncrementalRedstoneSimulator/ObserverHandler.h
+++ b/src/Simulator/IncrementalRedstoneSimulator/ObserverHandler.h
@@ -1,21 +1,20 @@
#pragma once
-#include "RedstoneHandler.h"
#include "../../Blocks/BlockObserver.h"
-class cObserverHandler final : public cRedstoneHandler
+namespace ObserverHandler
{
- inline static bool IsOn(NIBBLETYPE a_Meta)
+ inline bool IsOn(NIBBLETYPE a_Meta)
{
return (a_Meta & 0x8) == 0x8;
}
- static bool ShouldPowerOn(cChunk & Chunk, const Vector3i a_Position, NIBBLETYPE a_Meta, cIncrementalRedstoneSimulatorChunkData & a_Data)
+ inline bool ShouldPowerOn(cChunk & Chunk, const Vector3i a_Position, NIBBLETYPE a_Meta, cIncrementalRedstoneSimulatorChunkData & a_Data)
{
BLOCKTYPE BlockType;
NIBBLETYPE BlockMeta;
@@ -32,13 +31,13 @@ class cObserverHandler final : public cRedstoneHandler
return (Previous.PoweringBlock != Observed.PoweringBlock) || (Previous.PowerLevel != Observed.PowerLevel);
}
- virtual unsigned char GetPowerDeliveredToPosition(const cChunk & a_Chunk, Vector3i a_Position, BLOCKTYPE a_BlockType, Vector3i a_QueryPosition, BLOCKTYPE a_QueryBlockType, bool IsLinked) const override
+ inline unsigned char GetPowerDeliveredToPosition(const cChunk & a_Chunk, Vector3i a_Position, BLOCKTYPE a_BlockType, Vector3i a_QueryPosition, BLOCKTYPE a_QueryBlockType, bool IsLinked)
{
const auto Meta = a_Chunk.GetMeta(a_Position);
return (IsOn(Meta) && (a_QueryPosition == (a_Position + cBlockObserverHandler::GetSignalOutputOffset(Meta)))) ? 15 : 0;
}
- virtual void Update(cChunk & a_Chunk, cChunk & CurrentlyTicking, Vector3i a_Position, BLOCKTYPE a_BlockType, NIBBLETYPE a_Meta, PoweringData a_PoweringData) const override
+ inline void Update(cChunk & a_Chunk, cChunk & CurrentlyTicking, Vector3i a_Position, BLOCKTYPE a_BlockType, NIBBLETYPE a_Meta, PoweringData a_PoweringData)
{
// LOGD("Evaluating Lenny the observer (%i %i %i)", a_Position.x, a_Position.y, a_Position.z);
@@ -84,7 +83,7 @@ class cObserverHandler final : public cRedstoneHandler
UpdateAdjustedRelative(a_Chunk, CurrentlyTicking, a_Position, cBlockObserverHandler::GetSignalOutputOffset(a_Meta));
}
- virtual void ForValidSourcePositions(const cChunk & a_Chunk, Vector3i a_Position, BLOCKTYPE a_BlockType, NIBBLETYPE a_Meta, SourceCallback Callback) const override
+ inline void ForValidSourcePositions(const cChunk & a_Chunk, Vector3i a_Position, BLOCKTYPE a_BlockType, NIBBLETYPE a_Meta, ForEachSourceCallback & Callback)
{
UNUSED(a_Chunk);
UNUSED(a_Position);