summaryrefslogtreecommitdiffstats
path: root/src/Simulator/IncrementalRedstoneSimulator/RedstoneComparatorHandler.h
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@outlook.com>2020-08-20 21:04:28 +0200
committerTiger Wang <ziwei.tiger@outlook.com>2020-08-21 01:50:09 +0200
commitd8c8d0124da12587bbaf52992f7a8d2e0b010544 (patch)
tree305983c82fdb55ec7f9bc37cda1b54304f4a0ecf /src/Simulator/IncrementalRedstoneSimulator/RedstoneComparatorHandler.h
parentcChunk's deleted copy constructor needs const (diff)
downloadcuberite-d8c8d0124da12587bbaf52992f7a8d2e0b010544.tar
cuberite-d8c8d0124da12587bbaf52992f7a8d2e0b010544.tar.gz
cuberite-d8c8d0124da12587bbaf52992f7a8d2e0b010544.tar.bz2
cuberite-d8c8d0124da12587bbaf52992f7a8d2e0b010544.tar.lz
cuberite-d8c8d0124da12587bbaf52992f7a8d2e0b010544.tar.xz
cuberite-d8c8d0124da12587bbaf52992f7a8d2e0b010544.tar.zst
cuberite-d8c8d0124da12587bbaf52992f7a8d2e0b010544.zip
Diffstat (limited to 'src/Simulator/IncrementalRedstoneSimulator/RedstoneComparatorHandler.h')
-rw-r--r--src/Simulator/IncrementalRedstoneSimulator/RedstoneComparatorHandler.h16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/Simulator/IncrementalRedstoneSimulator/RedstoneComparatorHandler.h b/src/Simulator/IncrementalRedstoneSimulator/RedstoneComparatorHandler.h
index 7200eede0..a1045cdbb 100644
--- a/src/Simulator/IncrementalRedstoneSimulator/RedstoneComparatorHandler.h
+++ b/src/Simulator/IncrementalRedstoneSimulator/RedstoneComparatorHandler.h
@@ -23,7 +23,7 @@ namespace RedstoneComparatorHandler
}
}
- inline unsigned char GetPowerDeliveredToPosition(const cChunk & a_Chunk, Vector3i a_Position, BLOCKTYPE a_BlockType, Vector3i a_QueryPosition, BLOCKTYPE a_QueryBlockType, bool IsLinked)
+ inline PowerLevel GetPowerDeliveredToPosition(const cChunk & a_Chunk, Vector3i a_Position, BLOCKTYPE a_BlockType, Vector3i a_QueryPosition, BLOCKTYPE a_QueryBlockType, bool IsLinked)
{
UNUSED(a_QueryPosition);
UNUSED(a_QueryBlockType);
@@ -31,7 +31,7 @@ namespace RedstoneComparatorHandler
const auto Meta = a_Chunk.GetMeta(a_Position);
return (
(cBlockComparatorHandler::GetFrontCoordinate(a_Position, Meta & 0x3) == a_QueryPosition) ?
- DataForChunk(a_Chunk).GetCachedPowerData(a_Position).PowerLevel : 0
+ DataForChunk(a_Chunk).GetCachedPowerData(a_Position) : 0
);
}
@@ -79,9 +79,9 @@ namespace RedstoneComparatorHandler
);
}
- inline void Update(cChunk & a_Chunk, cChunk & CurrentlyTicking, Vector3i a_Position, BLOCKTYPE a_BlockType, NIBBLETYPE a_Meta, PoweringData a_PoweringData)
+ inline void Update(cChunk & a_Chunk, cChunk & CurrentlyTicking, Vector3i a_Position, BLOCKTYPE a_BlockType, NIBBLETYPE a_Meta, const PowerLevel Power)
{
- // Note that a_PoweringData here contains the maximum * side * power level, as specified by GetValidSourcePositions
+ // Note that Power here contains the maximum * side * power level, as specified by GetValidSourcePositions
// LOGD("Evaluating ALU the comparator (%d %d %d)", a_Position.x, a_Position.y, a_Position.z);
auto & Data = DataForChunk(a_Chunk);
@@ -91,9 +91,9 @@ namespace RedstoneComparatorHandler
if (DelayInfo == nullptr)
{
const auto RearPower = GetPowerLevel(a_Chunk, a_Position, a_BlockType, a_Meta);
- const auto FrontPower = GetFrontPowerLevel(a_Meta, a_PoweringData.PowerLevel, RearPower);
+ const auto FrontPower = GetFrontPowerLevel(a_Meta, Power, RearPower);
const auto PreviousFrontPower = Data.GetCachedPowerData(a_Position);
- const bool ShouldUpdate = (FrontPower != PreviousFrontPower.PowerLevel); // "Business logic" (:P) - determined by side and rear power levels
+ const bool ShouldUpdate = (FrontPower != PreviousFrontPower); // "Business logic" (:P) - determined by side and rear power levels
if (ShouldUpdate)
{
@@ -112,11 +112,11 @@ namespace RedstoneComparatorHandler
}
const auto RearPower = GetPowerLevel(a_Chunk, a_Position, a_BlockType, a_Meta);
- const auto FrontPower = GetFrontPowerLevel(a_Meta, a_PoweringData.PowerLevel, RearPower);
+ const auto FrontPower = GetFrontPowerLevel(a_Meta, Power, RearPower);
const auto NewMeta = (FrontPower > 0) ? (a_Meta | 0x8) : (a_Meta & 0x7);
// Don't care about the previous power level so return value ignored
- Data.ExchangeUpdateOncePowerData(a_Position, PoweringData(a_PoweringData.PoweringBlock, FrontPower));
+ Data.ExchangeUpdateOncePowerData(a_Position, FrontPower);
a_Chunk.SetMeta(a_Position, NewMeta);
Data.m_MechanismDelays.erase(a_Position);