diff options
author | Tiger Wang <ziwei.tiger@outlook.com> | 2020-07-29 02:18:59 +0200 |
---|---|---|
committer | Tiger Wang <ziwei.tiger@outlook.com> | 2020-08-02 16:52:06 +0200 |
commit | 225c2fa9f6bc2ebffcc9160090482e6833a220ce (patch) | |
tree | b72a5b27b49e38fe160da580a6f659a1a9d93308 /src/Simulator/IncrementalRedstoneSimulator/IncrementalRedstoneSimulator.cpp | |
parent | Add WakeUp/AddBlock distinction (diff) | |
download | cuberite-225c2fa9f6bc2ebffcc9160090482e6833a220ce.tar cuberite-225c2fa9f6bc2ebffcc9160090482e6833a220ce.tar.gz cuberite-225c2fa9f6bc2ebffcc9160090482e6833a220ce.tar.bz2 cuberite-225c2fa9f6bc2ebffcc9160090482e6833a220ce.tar.lz cuberite-225c2fa9f6bc2ebffcc9160090482e6833a220ce.tar.xz cuberite-225c2fa9f6bc2ebffcc9160090482e6833a220ce.tar.zst cuberite-225c2fa9f6bc2ebffcc9160090482e6833a220ce.zip |
Diffstat (limited to 'src/Simulator/IncrementalRedstoneSimulator/IncrementalRedstoneSimulator.cpp')
-rw-r--r-- | src/Simulator/IncrementalRedstoneSimulator/IncrementalRedstoneSimulator.cpp | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/src/Simulator/IncrementalRedstoneSimulator/IncrementalRedstoneSimulator.cpp b/src/Simulator/IncrementalRedstoneSimulator/IncrementalRedstoneSimulator.cpp index 33c0f9523..f2c8b7e65 100644 --- a/src/Simulator/IncrementalRedstoneSimulator/IncrementalRedstoneSimulator.cpp +++ b/src/Simulator/IncrementalRedstoneSimulator/IncrementalRedstoneSimulator.cpp @@ -273,26 +273,18 @@ void cIncrementalRedstoneSimulator::ProcessWorkItem(cChunk & Chunk, cChunk & Tic void cIncrementalRedstoneSimulator::AddBlock(cChunk & a_Chunk, Vector3i a_Position, BLOCKTYPE a_Block) { - // Can't inspect block, ignore: - if ((a_Chunk == nullptr) || !a_Chunk->IsValid()) - { - return; - } - - auto & ChunkData = *static_cast<cIncrementalRedstoneSimulatorChunkData *>(a_Chunk->GetRedstoneSimulatorData()); - const auto Relative = cChunkDef::AbsoluteToRelative(a_Block, a_Chunk->GetPos()); - const auto CurrentBlock = a_Chunk->GetBlock(Relative); + auto & ChunkData = *static_cast<cIncrementalRedstoneSimulatorChunkData *>(a_Chunk.GetRedstoneSimulatorData()); - if (!IsRedstone(CurrentBlock)) + if (!IsRedstone(a_Block)) { return; } - if (IsAlwaysTicked(CurrentBlock)) + if (IsAlwaysTicked(a_Block)) { - ChunkData.AlwaysTickedPositions.emplace(Relative); + ChunkData.AlwaysTickedPositions.emplace(a_Position); } // Always update redstone devices: - ChunkData.WakeUp(Relative); + ChunkData.WakeUp(a_Position); } |