From af514acd8c4af3ed1fb03fae3c0c612d7e472a7c Mon Sep 17 00:00:00 2001 From: Marvin Kopf Date: Sun, 7 Feb 2016 15:27:24 +0100 Subject: Update RedstoneSimulator to delete unused cached PowerData When a new block was placed that has a corresponding RedstoneHandler the PowerData for the position was cached, but never deleted and remained unchanged when the block got destroyed. The RedstoneSimulator now erases all cached PowerData for positions where the block doesn't have a RedstoneHandler (i.e. Air). --- .../IncrementalRedstoneSimulator/RedstoneSimulatorChunkData.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/Simulator/IncrementalRedstoneSimulator/RedstoneSimulatorChunkData.h') diff --git a/src/Simulator/IncrementalRedstoneSimulator/RedstoneSimulatorChunkData.h b/src/Simulator/IncrementalRedstoneSimulator/RedstoneSimulatorChunkData.h index 8e025d154..b461512f0 100644 --- a/src/Simulator/IncrementalRedstoneSimulator/RedstoneSimulatorChunkData.h +++ b/src/Simulator/IncrementalRedstoneSimulator/RedstoneSimulatorChunkData.h @@ -41,6 +41,12 @@ public: return (Result == m_MechanismDelays.end()) ? nullptr : &Result->second; } + /** Erase cached PowerData for position */ + void ErasePowerData(const Vector3i & a_Position) + { + m_CachedPowerLevels.erase(a_Position); + } + cRedstoneHandler::PoweringData ExchangeUpdateOncePowerData(const Vector3i & a_Position, cRedstoneHandler::PoweringData a_PoweringData) { auto Result = m_CachedPowerLevels.find(a_Position); -- cgit v1.2.3