summaryrefslogtreecommitdiffstats
path: root/src/Simulator/IncrementalRedstoneSimulator/RedstoneDataHelper.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/Simulator/IncrementalRedstoneSimulator/RedstoneDataHelper.h')
-rw-r--r--src/Simulator/IncrementalRedstoneSimulator/RedstoneDataHelper.h68
1 files changed, 41 insertions, 27 deletions
diff --git a/src/Simulator/IncrementalRedstoneSimulator/RedstoneDataHelper.h b/src/Simulator/IncrementalRedstoneSimulator/RedstoneDataHelper.h
index 3942f803c..e10c6027f 100644
--- a/src/Simulator/IncrementalRedstoneSimulator/RedstoneDataHelper.h
+++ b/src/Simulator/IncrementalRedstoneSimulator/RedstoneDataHelper.h
@@ -7,7 +7,12 @@ inline auto & DataForChunk(const cChunk & a_Chunk)
return *static_cast<cIncrementalRedstoneSimulatorChunkData *>(a_Chunk.GetRedstoneSimulatorData());
}
-inline void UpdateAdjustedRelative(const cChunk & a_Chunk, const cChunk & a_TickingChunk, const Vector3i a_Position, const Vector3i a_Offset)
+inline void UpdateAdjustedRelative(
+ const cChunk & a_Chunk,
+ const cChunk & a_TickingChunk,
+ const Vector3i a_Position,
+ const Vector3i a_Offset
+)
{
const auto PositionToWake = a_Position + a_Offset;
@@ -20,20 +25,31 @@ inline void UpdateAdjustedRelative(const cChunk & a_Chunk, const cChunk & a_Tick
auto & ChunkData = DataForChunk(a_TickingChunk);
// Schedule the block in the requested direction to update:
- ChunkData.WakeUp(cIncrementalRedstoneSimulatorChunkData::RebaseRelativePosition(a_Chunk, a_TickingChunk, PositionToWake));
+ ChunkData.WakeUp(
+ cIncrementalRedstoneSimulatorChunkData::RebaseRelativePosition(a_Chunk, a_TickingChunk, PositionToWake)
+ );
// To follow Vanilla behaviour, update all linked positions:
for (const auto & LinkedOffset : cSimulator::GetLinkedOffsets(a_Offset))
{
if (const auto LinkedPositionToWake = a_Position + LinkedOffset; cChunkDef::IsValidHeight(LinkedPositionToWake))
{
- ChunkData.WakeUp(cIncrementalRedstoneSimulatorChunkData::RebaseRelativePosition(a_Chunk, a_TickingChunk, LinkedPositionToWake));
+ ChunkData.WakeUp(cIncrementalRedstoneSimulatorChunkData::RebaseRelativePosition(
+ a_Chunk,
+ a_TickingChunk,
+ LinkedPositionToWake
+ ));
}
}
}
template <typename ArrayType>
-inline void UpdateAdjustedRelatives(const cChunk & a_Chunk, const cChunk & a_TickingChunk, const Vector3i a_Position, const ArrayType & a_Relative)
+inline void UpdateAdjustedRelatives(
+ const cChunk & a_Chunk,
+ const cChunk & a_TickingChunk,
+ const Vector3i a_Position,
+ const ArrayType & a_Relative
+)
{
for (const auto & Offset : a_Relative)
{
@@ -42,7 +58,11 @@ inline void UpdateAdjustedRelatives(const cChunk & a_Chunk, const cChunk & a_Tic
}
template <typename ArrayType>
-inline void InvokeForAdjustedRelatives(ForEachSourceCallback & Callback, const Vector3i Position, const ArrayType & Relative)
+inline void InvokeForAdjustedRelatives(
+ ForEachSourceCallback & Callback,
+ const Vector3i Position,
+ const ArrayType & Relative
+)
{
for (const auto & Offset : Relative)
{
@@ -50,28 +70,22 @@ inline void InvokeForAdjustedRelatives(ForEachSourceCallback & Callback, const V
}
}
-inline constexpr Vector3i OffsetYP{ 0, 1, 0 };
+inline constexpr Vector3i OffsetYP {0, 1, 0};
-inline constexpr Vector3i OffsetYM{ 0, -1, 0 };
+inline constexpr Vector3i OffsetYM {0, -1, 0};
-inline constexpr std::array<Vector3i, 6> RelativeAdjacents
-{
- {
- { 1, 0, 0 },
- { -1, 0, 0 },
- { 0, 1, 0 },
- { 0, -1, 0 },
- { 0, 0, 1 },
- { 0, 0, -1 },
- }
-};
+inline constexpr std::array<Vector3i, 6> RelativeAdjacents {{
+ {1, 0, 0},
+ {-1, 0, 0},
+ {0, 1, 0},
+ {0, -1, 0},
+ {0, 0, 1},
+ {0, 0, -1},
+}};
-inline constexpr std::array<Vector3i, 4> RelativeLaterals
-{
- {
- { 1, 0, 0 },
- { -1, 0, 0 },
- { 0, 0, 1 },
- { 0, 0, -1 },
- }
-};
+inline constexpr std::array<Vector3i, 4> RelativeLaterals {{
+ {1, 0, 0},
+ {-1, 0, 0},
+ {0, 0, 1},
+ {0, 0, -1},
+}};