diff options
author | Tiger Wang <ziwei.tiger@outlook.com> | 2020-08-08 19:22:16 +0200 |
---|---|---|
committer | Tiger Wang <ziwei.tiger@outlook.com> | 2020-08-08 19:22:16 +0200 |
commit | 40eba5244ddd7045a9c3539c5f46c9921301ed90 (patch) | |
tree | 9edf40e2e5033ad19ce8a0739668500e30de653e /src/Simulator/IncrementalRedstoneSimulator/RedstoneSimulatorChunkData.h | |
parent | const-ify some Chunk functions (diff) | |
download | cuberite-40eba5244ddd7045a9c3539c5f46c9921301ed90.tar cuberite-40eba5244ddd7045a9c3539c5f46c9921301ed90.tar.gz cuberite-40eba5244ddd7045a9c3539c5f46c9921301ed90.tar.bz2 cuberite-40eba5244ddd7045a9c3539c5f46c9921301ed90.tar.lz cuberite-40eba5244ddd7045a9c3539c5f46c9921301ed90.tar.xz cuberite-40eba5244ddd7045a9c3539c5f46c9921301ed90.tar.zst cuberite-40eba5244ddd7045a9c3539c5f46c9921301ed90.zip |
Diffstat (limited to 'src/Simulator/IncrementalRedstoneSimulator/RedstoneSimulatorChunkData.h')
-rw-r--r-- | src/Simulator/IncrementalRedstoneSimulator/RedstoneSimulatorChunkData.h | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/Simulator/IncrementalRedstoneSimulator/RedstoneSimulatorChunkData.h b/src/Simulator/IncrementalRedstoneSimulator/RedstoneSimulatorChunkData.h index eb5dfc92d..f8e7eb466 100644 --- a/src/Simulator/IncrementalRedstoneSimulator/RedstoneSimulatorChunkData.h +++ b/src/Simulator/IncrementalRedstoneSimulator/RedstoneSimulatorChunkData.h @@ -4,6 +4,7 @@ #include <stack> #include "../RedstoneSimulator.h" +#include "../../Chunk.h" @@ -53,7 +54,7 @@ public: -class cIncrementalRedstoneSimulatorChunkData : public cRedstoneSimulatorChunkData +class cIncrementalRedstoneSimulatorChunkData final : public cRedstoneSimulatorChunkData { public: @@ -90,6 +91,7 @@ public: m_CachedPowerLevels.erase(Position); m_MechanismDelays.erase(Position); AlwaysTickedPositions.erase(Position); + WireStates.erase(Position); } PoweringData ExchangeUpdateOncePowerData(const Vector3i & a_Position, PoweringData a_PoweringData) @@ -105,7 +107,7 @@ public: } /** Adjust From-relative coordinates into To-relative coordinates. */ - inline static Vector3i RebaseRelativePosition(cChunk & From, cChunk & To, const Vector3i Position) + inline static Vector3i RebaseRelativePosition(const cChunk & From, const cChunk & To, const Vector3i Position) { return { @@ -115,9 +117,12 @@ public: }; } + /** Temporary, should be chunk data: wire block store, to avoid recomputing states every time. */ + std::unordered_map<Vector3i, short, VectorHasher<int>> WireStates; + std::unordered_set<Vector3i, VectorHasher<int>> AlwaysTickedPositions; - /** Structure storing position of mechanism + it's delay ticks (countdown) & if to power on */ + /** Structure storing position of mechanism + it's delay ticks (countdown) & if to power on. */ std::unordered_map<Vector3i, std::pair<int, bool>, VectorHasher<int>> m_MechanismDelays; private: |