summaryrefslogtreecommitdiffstats
path: root/src/Simulator/IncrementalRedstoneSimulator/RedstoneTorchHandler.h
diff options
context:
space:
mode:
authorpeterbell10 <peterbell10@live.co.uk>2017-07-15 04:09:55 +0200
committerLukas Pioch <lukas@zgow.de>2017-07-17 21:40:43 +0200
commit60dfaa09679219868e58a44d6d86f5d8d524ce24 (patch)
tree66bbbc719322c331b68ab9f49b7a07ef7a870c1f /src/Simulator/IncrementalRedstoneSimulator/RedstoneTorchHandler.h
parentSimulators: Added area-based wakeup. (diff)
downloadcuberite-60dfaa09679219868e58a44d6d86f5d8d524ce24.tar
cuberite-60dfaa09679219868e58a44d6d86f5d8d524ce24.tar.gz
cuberite-60dfaa09679219868e58a44d6d86f5d8d524ce24.tar.bz2
cuberite-60dfaa09679219868e58a44d6d86f5d8d524ce24.tar.lz
cuberite-60dfaa09679219868e58a44d6d86f5d8d524ce24.tar.xz
cuberite-60dfaa09679219868e58a44d6d86f5d8d524ce24.tar.zst
cuberite-60dfaa09679219868e58a44d6d86f5d8d524ce24.zip
Diffstat (limited to 'src/Simulator/IncrementalRedstoneSimulator/RedstoneTorchHandler.h')
-rw-r--r--src/Simulator/IncrementalRedstoneSimulator/RedstoneTorchHandler.h20
1 files changed, 8 insertions, 12 deletions
diff --git a/src/Simulator/IncrementalRedstoneSimulator/RedstoneTorchHandler.h b/src/Simulator/IncrementalRedstoneSimulator/RedstoneTorchHandler.h
index a95cf2e24..b892dedb5 100644
--- a/src/Simulator/IncrementalRedstoneSimulator/RedstoneTorchHandler.h
+++ b/src/Simulator/IncrementalRedstoneSimulator/RedstoneTorchHandler.h
@@ -11,17 +11,12 @@ class cRedstoneTorchHandler : public cRedstoneHandler
{
public:
- cRedstoneTorchHandler(cWorld & a_World) :
- cRedstoneHandler(a_World)
- {
- }
-
inline static bool IsOn(BLOCKTYPE a_Block)
{
return (a_Block == E_BLOCK_REDSTONE_TORCH_ON);
}
- inline static const Vector3i GetOffsetAttachedTo(const Vector3i & a_Position, NIBBLETYPE a_Meta)
+ inline static Vector3i GetOffsetAttachedTo(const Vector3i & a_Position, NIBBLETYPE a_Meta)
{
switch (a_Meta)
{
@@ -38,7 +33,7 @@ public:
}
}
- virtual unsigned char GetPowerDeliveredToPosition(const Vector3i & a_Position, BLOCKTYPE a_BlockType, NIBBLETYPE a_Meta, const Vector3i & a_QueryPosition, BLOCKTYPE a_QueryBlockType) override
+ virtual unsigned char GetPowerDeliveredToPosition(cWorld & a_World, const Vector3i & a_Position, BLOCKTYPE a_BlockType, NIBBLETYPE a_Meta, const Vector3i & a_QueryPosition, BLOCKTYPE a_QueryBlockType) const override
{
if (
IsOn(a_BlockType) &&
@@ -51,16 +46,16 @@ public:
return 0;
}
- virtual unsigned char GetPowerLevel(const Vector3i & a_Position, BLOCKTYPE a_BlockType, NIBBLETYPE a_Meta) override
+ virtual unsigned char GetPowerLevel(cWorld & a_World, const Vector3i & a_Position, BLOCKTYPE a_BlockType, NIBBLETYPE a_Meta) const override
{
return IsOn(a_BlockType) ? 15 : 0;
}
- virtual cVector3iArray Update(const Vector3i & a_Position, BLOCKTYPE a_BlockType, NIBBLETYPE a_Meta, PoweringData a_PoweringData) override
+ virtual cVector3iArray Update(cWorld & a_World, const Vector3i & a_Position, BLOCKTYPE a_BlockType, NIBBLETYPE a_Meta, PoweringData a_PoweringData) const override
{
// LOGD("Evaluating torchy the redstone torch (%i %i %i)", a_Position.x, a_Position.y, a_Position.z);
- auto Data = static_cast<cIncrementalRedstoneSimulator *>(m_World.GetRedstoneSimulator())->GetChunkData();
+ auto Data = static_cast<cIncrementalRedstoneSimulator *>(a_World.GetRedstoneSimulator())->GetChunkData();
auto DelayInfo = Data->GetMechanismDelayInfo(a_Position);
if (DelayInfo == nullptr)
@@ -79,7 +74,7 @@ public:
if (DelayTicks == 0)
{
- m_World.SetBlock(a_Position.x, a_Position.y, a_Position.z, ShouldPowerOn ? E_BLOCK_REDSTONE_TORCH_ON : E_BLOCK_REDSTONE_TORCH_OFF, a_Meta);
+ a_World.SetBlock(a_Position.x, a_Position.y, a_Position.z, ShouldPowerOn ? E_BLOCK_REDSTONE_TORCH_ON : E_BLOCK_REDSTONE_TORCH_OFF, a_Meta);
Data->m_MechanismDelays.erase(a_Position);
cVector3iArray RelativePositions = GetRelativeAdjacents();
@@ -91,8 +86,9 @@ public:
return {};
}
- virtual cVector3iArray GetValidSourcePositions(const Vector3i & a_Position, BLOCKTYPE a_BlockType, NIBBLETYPE a_Meta) override
+ virtual cVector3iArray GetValidSourcePositions(cWorld & a_World, const Vector3i & a_Position, BLOCKTYPE a_BlockType, NIBBLETYPE a_Meta) const override
{
+ UNUSED(a_World);
UNUSED(a_BlockType);
return { (a_Position + GetOffsetAttachedTo(a_Position, a_Meta)) };
}