summaryrefslogtreecommitdiffstats
path: root/src/Simulator/IncrementalRedstoneSimulator
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@outlook.com>2020-07-28 01:13:07 +0200
committerTiger Wang <ziwei.tiger@outlook.com>2020-08-02 16:52:06 +0200
commit6c47f46c31813836efa5af199766aff23fed9dd3 (patch)
tree9addb1d1615895079388d1e405c5358fe182b1e3 /src/Simulator/IncrementalRedstoneSimulator
parentReplaced cpp14::make_unique<> with std::make_unique<>. (diff)
downloadcuberite-6c47f46c31813836efa5af199766aff23fed9dd3.tar
cuberite-6c47f46c31813836efa5af199766aff23fed9dd3.tar.gz
cuberite-6c47f46c31813836efa5af199766aff23fed9dd3.tar.bz2
cuberite-6c47f46c31813836efa5af199766aff23fed9dd3.tar.lz
cuberite-6c47f46c31813836efa5af199766aff23fed9dd3.tar.xz
cuberite-6c47f46c31813836efa5af199766aff23fed9dd3.tar.zst
cuberite-6c47f46c31813836efa5af199766aff23fed9dd3.zip
Diffstat (limited to 'src/Simulator/IncrementalRedstoneSimulator')
-rw-r--r--src/Simulator/IncrementalRedstoneSimulator/ObserverHandler.h2
-rw-r--r--src/Simulator/IncrementalRedstoneSimulator/PoweredRailHandler.h4
-rw-r--r--src/Simulator/IncrementalRedstoneSimulator/PressurePlateHandler.h2
-rw-r--r--src/Simulator/IncrementalRedstoneSimulator/RedstoneComparatorHandler.h2
-rw-r--r--src/Simulator/IncrementalRedstoneSimulator/RedstoneHandler.h8
-rw-r--r--src/Simulator/IncrementalRedstoneSimulator/RedstoneRepeaterHandler.h3
-rw-r--r--src/Simulator/IncrementalRedstoneSimulator/RedstoneTorchHandler.h2
-rw-r--r--src/Simulator/IncrementalRedstoneSimulator/RedstoneWireHandler.h4
-rw-r--r--src/Simulator/IncrementalRedstoneSimulator/TrappedChestHandler.h2
9 files changed, 15 insertions, 14 deletions
diff --git a/src/Simulator/IncrementalRedstoneSimulator/ObserverHandler.h b/src/Simulator/IncrementalRedstoneSimulator/ObserverHandler.h
index a3c055844..211e3c64a 100644
--- a/src/Simulator/IncrementalRedstoneSimulator/ObserverHandler.h
+++ b/src/Simulator/IncrementalRedstoneSimulator/ObserverHandler.h
@@ -87,7 +87,7 @@ public:
a_Chunk.SetMeta(a_Position, a_Meta & ~0x8);
}
- UpdateAdjustedRelatives(a_Chunk, CurrentlyTicking, a_Position + cBlockObserverHandler::GetSignalOutputOffset(a_Meta));
+ UpdateAdjustedRelative(a_Chunk, CurrentlyTicking, a_Position + cBlockObserverHandler::GetSignalOutputOffset(a_Meta));
}
virtual void ForValidSourcePositions(cChunk & a_Chunk, Vector3i a_Position, BLOCKTYPE a_BlockType, NIBBLETYPE a_Meta, SourceCallback Callback) const override
diff --git a/src/Simulator/IncrementalRedstoneSimulator/PoweredRailHandler.h b/src/Simulator/IncrementalRedstoneSimulator/PoweredRailHandler.h
index 38fbf8d98..9e58e09ad 100644
--- a/src/Simulator/IncrementalRedstoneSimulator/PoweredRailHandler.h
+++ b/src/Simulator/IncrementalRedstoneSimulator/PoweredRailHandler.h
@@ -66,8 +66,8 @@ public:
{
a_Chunk.SetMeta(a_Position, (a_PoweringData.PowerLevel == 0) ? (a_Meta & 0x07) : (a_Meta | 0x08));
- UpdateAdjustedRelatives(a_Chunk, CurrentlyTickingChunk, a_Position + Offset);
- UpdateAdjustedRelatives(a_Chunk, CurrentlyTickingChunk, a_Position + -Offset);
+ UpdateAdjustedRelative(a_Chunk, CurrentlyTickingChunk, a_Position + Offset);
+ UpdateAdjustedRelative(a_Chunk, CurrentlyTickingChunk, a_Position + -Offset);
}
return;
diff --git a/src/Simulator/IncrementalRedstoneSimulator/PressurePlateHandler.h b/src/Simulator/IncrementalRedstoneSimulator/PressurePlateHandler.h
index c2791e45c..f6969e15a 100644
--- a/src/Simulator/IncrementalRedstoneSimulator/PressurePlateHandler.h
+++ b/src/Simulator/IncrementalRedstoneSimulator/PressurePlateHandler.h
@@ -72,8 +72,8 @@ public:
static void UpdatePlate(cChunk & Chunk, cChunk & CurrentlyTicking, Vector3i Position)
{
+ UpdateAdjustedRelative(Chunk, CurrentlyTicking, Position + OffsetYM);
UpdateAdjustedRelatives(Chunk, CurrentlyTicking, Position, RelativeLaterals);
- UpdateAdjustedRelatives(Chunk, CurrentlyTicking, Position + OffsetYM);
}
virtual void Update(cChunk & a_Chunk, cChunk & CurrentlyTicking, Vector3i a_Position, BLOCKTYPE a_BlockType, NIBBLETYPE a_Meta, PoweringData a_PoweringData) const override
diff --git a/src/Simulator/IncrementalRedstoneSimulator/RedstoneComparatorHandler.h b/src/Simulator/IncrementalRedstoneSimulator/RedstoneComparatorHandler.h
index b0dad2026..4ccb6838e 100644
--- a/src/Simulator/IncrementalRedstoneSimulator/RedstoneComparatorHandler.h
+++ b/src/Simulator/IncrementalRedstoneSimulator/RedstoneComparatorHandler.h
@@ -129,7 +129,7 @@ public:
Data.m_MechanismDelays.erase(a_Position);
// Assume that an update (to front power) is needed:
- UpdateAdjustedRelatives(a_Chunk, CurrentlyTicking, cBlockComparatorHandler::GetFrontCoordinate(a_Position, a_Meta & 0x3));
+ UpdateAdjustedRelative(a_Chunk, CurrentlyTicking, cBlockComparatorHandler::GetFrontCoordinate(a_Position, a_Meta & 0x3));
}
}
}
diff --git a/src/Simulator/IncrementalRedstoneSimulator/RedstoneHandler.h b/src/Simulator/IncrementalRedstoneSimulator/RedstoneHandler.h
index fec38b14d..79c410265 100644
--- a/src/Simulator/IncrementalRedstoneSimulator/RedstoneHandler.h
+++ b/src/Simulator/IncrementalRedstoneSimulator/RedstoneHandler.h
@@ -53,7 +53,7 @@ protected:
}
template <typename... ArrayTypes>
- static void UpdateAdjustedRelatives(cChunk & From, cChunk & To, const Vector3i Position)
+ static void UpdateAdjustedRelative(cChunk & From, cChunk & To, const Vector3i Position)
{
DataForChunk(To).WakeUp(cIncrementalRedstoneSimulatorChunkData::RebaseRelativePosition(From, To, Position));
}
@@ -70,7 +70,7 @@ protected:
}
template <typename ArrayType, typename... ArrayTypes>
- static void InvokeForAdjustedRelatives(SourceCallback Callback, Vector3i Position, const ArrayType & Relative, const ArrayTypes &... Relatives)
+ static void InvokeForAdjustedRelatives(SourceCallback Callback, const Vector3i Position, const ArrayType & Relative, const ArrayTypes &... Relatives)
{
for (const auto Offset : Relative)
{
@@ -104,11 +104,11 @@ protected:
private:
- static void UpdateAdjustedRelatives(cVector3iArray &, Vector3i)
+ static void UpdateAdjustedRelatives(cChunk &, cChunk &, const Vector3i)
{
}
- static void InvokeForAdjustedRelatives(SourceCallback, Vector3i)
+ static void InvokeForAdjustedRelatives(SourceCallback, const Vector3i)
{
}
};
diff --git a/src/Simulator/IncrementalRedstoneSimulator/RedstoneRepeaterHandler.h b/src/Simulator/IncrementalRedstoneSimulator/RedstoneRepeaterHandler.h
index 4174ac930..711d1762d 100644
--- a/src/Simulator/IncrementalRedstoneSimulator/RedstoneRepeaterHandler.h
+++ b/src/Simulator/IncrementalRedstoneSimulator/RedstoneRepeaterHandler.h
@@ -63,7 +63,8 @@ public:
// FastSetBlock doesn't wake simulators, so manually update ourselves:
Update(a_Chunk, CurrentlyTicking, a_Position, NewType, a_Meta, a_PoweringData);
- UpdateAdjustedRelatives(a_Chunk, CurrentlyTicking, a_Position + cBlockRedstoneRepeaterHandler::GetFrontCoordinateOffset(a_Meta));
+ UpdateAdjustedRelative(a_Chunk, CurrentlyTicking, a_Position + cBlockRedstoneRepeaterHandler::GetFrontCoordinateOffset(a_Meta));
+ UpdateAdjustedRelatives(a_Chunk, CurrentlyTicking, a_Position + cBlockRedstoneRepeaterHandler::GetFrontCoordinateOffset(a_Meta), RelativeAdjacents);
}
}
}
diff --git a/src/Simulator/IncrementalRedstoneSimulator/RedstoneTorchHandler.h b/src/Simulator/IncrementalRedstoneSimulator/RedstoneTorchHandler.h
index c935e1f1b..65cf32204 100644
--- a/src/Simulator/IncrementalRedstoneSimulator/RedstoneTorchHandler.h
+++ b/src/Simulator/IncrementalRedstoneSimulator/RedstoneTorchHandler.h
@@ -79,7 +79,7 @@ public:
{
if (Adjacent != GetOffsetAttachedTo(a_Position, a_Meta))
{
- UpdateAdjustedRelatives(a_Chunk, CurrentlyTicking, a_Position + Adjacent);
+ UpdateAdjustedRelative(a_Chunk, CurrentlyTicking, a_Position + Adjacent);
}
}
}
diff --git a/src/Simulator/IncrementalRedstoneSimulator/RedstoneWireHandler.h b/src/Simulator/IncrementalRedstoneSimulator/RedstoneWireHandler.h
index 3a782d1d3..5bf4afcd3 100644
--- a/src/Simulator/IncrementalRedstoneSimulator/RedstoneWireHandler.h
+++ b/src/Simulator/IncrementalRedstoneSimulator/RedstoneWireHandler.h
@@ -177,12 +177,12 @@ public:
a_Chunk.SetMeta(a_Position, a_PoweringData.PowerLevel);
// Notify block below us to update:
- UpdateAdjustedRelatives(a_Chunk, CurrentlyTicking, a_Position + OffsetYM);
+ UpdateAdjustedRelative(a_Chunk, CurrentlyTicking, a_Position + OffsetYM);
// Notify all terracing positions:
ForTerracingConnectionOffsets(a_Chunk, a_Position, [&a_Chunk, &CurrentlyTicking, a_Position](const Vector3i Offset)
{
- UpdateAdjustedRelatives(a_Chunk, CurrentlyTicking, a_Position + Offset);
+ UpdateAdjustedRelative(a_Chunk, CurrentlyTicking, a_Position + Offset);
return false;
});
}
diff --git a/src/Simulator/IncrementalRedstoneSimulator/TrappedChestHandler.h b/src/Simulator/IncrementalRedstoneSimulator/TrappedChestHandler.h
index 707c239e9..e3deea5e9 100644
--- a/src/Simulator/IncrementalRedstoneSimulator/TrappedChestHandler.h
+++ b/src/Simulator/IncrementalRedstoneSimulator/TrappedChestHandler.h
@@ -49,7 +49,7 @@ public:
if (Power != PreviousPower.PowerLevel)
{
- UpdateAdjustedRelatives(a_Chunk, CurrentlyTicking, OffsetYM);
+ UpdateAdjustedRelative(a_Chunk, CurrentlyTicking, OffsetYM);
UpdateAdjustedRelatives(a_Chunk, CurrentlyTicking, a_Position, RelativeLaterals);
}
}