diff options
author | Tiger Wang <ziwei.tiger@outlook.com> | 2020-07-26 17:08:20 +0200 |
---|---|---|
committer | Tiger Wang <ziwei.tiger@outlook.com> | 2020-07-26 17:08:20 +0200 |
commit | 1673c8497852c3a6a90cf793cf4dffcbaef4b6d7 (patch) | |
tree | 763592d98c4688bf8061a1742a995a57f57b160c /src | |
parent | Toggleables: update simulators when changed (diff) | |
download | cuberite-1673c8497852c3a6a90cf793cf4dffcbaef4b6d7.tar cuberite-1673c8497852c3a6a90cf793cf4dffcbaef4b6d7.tar.gz cuberite-1673c8497852c3a6a90cf793cf4dffcbaef4b6d7.tar.bz2 cuberite-1673c8497852c3a6a90cf793cf4dffcbaef4b6d7.tar.lz cuberite-1673c8497852c3a6a90cf793cf4dffcbaef4b6d7.tar.xz cuberite-1673c8497852c3a6a90cf793cf4dffcbaef4b6d7.tar.zst cuberite-1673c8497852c3a6a90cf793cf4dffcbaef4b6d7.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Simulator/IncrementalRedstoneSimulator/IncrementalRedstoneSimulator.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/Simulator/IncrementalRedstoneSimulator/IncrementalRedstoneSimulator.cpp b/src/Simulator/IncrementalRedstoneSimulator/IncrementalRedstoneSimulator.cpp index 2eb515604..c4aa0a94b 100644 --- a/src/Simulator/IncrementalRedstoneSimulator/IncrementalRedstoneSimulator.cpp +++ b/src/Simulator/IncrementalRedstoneSimulator/IncrementalRedstoneSimulator.cpp @@ -152,7 +152,7 @@ void cIncrementalRedstoneSimulator::SimulateChunk(std::chrono::milliseconds a_Dt const auto NeighbourChunk = a_Chunk->GetRelNeighborChunkAdjustCoords(CurrentLocation); if ((NeighbourChunk == nullptr) || !NeighbourChunk->IsValid()) { - return; + continue; } ProcessWorkItem(*NeighbourChunk, *a_Chunk, CurrentLocation); @@ -170,17 +170,15 @@ void cIncrementalRedstoneSimulator::SimulateChunk(std::chrono::milliseconds a_Dt void cIncrementalRedstoneSimulator::ProcessWorkItem(cChunk & Chunk, cChunk & TickingSource, const Vector3i Position) { - auto & ChunkData = *static_cast<cIncrementalRedstoneSimulatorChunkData *>(Chunk.GetRedstoneSimulatorData()); - BLOCKTYPE CurrentBlock; NIBBLETYPE CurrentMeta; Chunk.GetBlockTypeMeta(Position, CurrentBlock, CurrentMeta); auto CurrentHandler = GetComponentHandler(CurrentBlock); - if (CurrentHandler == nullptr) // Block at CurrentPosition doesn't have a corresponding redstone handler + if (CurrentHandler == nullptr) { - // Clean up cached PowerData for CurrentPosition - ChunkData.ErasePowerData(Position); + // Block at Position doesn't have a corresponding redstone handler + // ErasePowerData will have been called in AddBlock return; } @@ -229,7 +227,7 @@ void cIncrementalRedstoneSimulator::ProcessWorkItem(cChunk & Chunk, cChunk & Tic void cIncrementalRedstoneSimulator::AddBlock(Vector3i a_Block, cChunk * a_Chunk) { // Can't inspect block, ignore: - if ((a_Chunk == nullptr) || (!a_Chunk->IsValid())) + if ((a_Chunk == nullptr) || !a_Chunk->IsValid()) { return; } |