diff options
Diffstat (limited to 'src/Simulator/IncrementalRedstoneSimulator')
-rw-r--r-- | src/Simulator/IncrementalRedstoneSimulator/RedstoneSimulatorChunkData.h | 7 | ||||
-rw-r--r-- | src/Simulator/IncrementalRedstoneSimulator/RedstoneWireHandler.h | 8 |
2 files changed, 8 insertions, 7 deletions
diff --git a/src/Simulator/IncrementalRedstoneSimulator/RedstoneSimulatorChunkData.h b/src/Simulator/IncrementalRedstoneSimulator/RedstoneSimulatorChunkData.h index 02da327a1..f9545d997 100644 --- a/src/Simulator/IncrementalRedstoneSimulator/RedstoneSimulatorChunkData.h +++ b/src/Simulator/IncrementalRedstoneSimulator/RedstoneSimulatorChunkData.h @@ -3,8 +3,9 @@ #include <stack> -#include "../RedstoneSimulator.h" -#include "../../Chunk.h" +#include "Chunk.h" +#include "BlockState.h" +#include "Simulator/RedstoneSimulator.h" @@ -82,7 +83,7 @@ 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_map<Vector3i, BlockState, VectorHasher<int>> WireStates; std::unordered_set<Vector3i, VectorHasher<int>> AlwaysTickedPositions; diff --git a/src/Simulator/IncrementalRedstoneSimulator/RedstoneWireHandler.h b/src/Simulator/IncrementalRedstoneSimulator/RedstoneWireHandler.h index c97f37aa5..66709293a 100644 --- a/src/Simulator/IncrementalRedstoneSimulator/RedstoneWireHandler.h +++ b/src/Simulator/IncrementalRedstoneSimulator/RedstoneWireHandler.h @@ -2,7 +2,7 @@ #pragma once #include "RedstoneHandler.h" -#include "../../Registries/Blocks.h" +#include "Registries/BlockStates.h" @@ -20,7 +20,7 @@ namespace RedstoneWireHandler /** Invokes Callback with the wire's left, front, and right direction state corresponding to Offset. Returns a new block constructed from the directions that the callback may have modified. */ template <class OffsetCallback> - inline short DoWithDirectionState(const Vector3i Offset, short Block, OffsetCallback Callback) + inline BlockState DoWithDirectionState(const Vector3i Offset, BlockState Block, OffsetCallback Callback) { auto North = Block::RedstoneWire::North(Block); auto South = Block::RedstoneWire::South(Block); @@ -49,7 +49,7 @@ namespace RedstoneWireHandler } /** Adjusts a given wire block so that the direction represented by Offset has state Direction. */ - inline void SetDirectionState(const Vector3i Offset, short & Block, TemporaryDirection Direction) + inline void SetDirectionState(const Vector3i Offset, BlockState & Block, TemporaryDirection Direction) { Block = DoWithDirectionState(Offset, Block, [Direction](auto, auto & Front, auto) { @@ -189,7 +189,7 @@ namespace RedstoneWireHandler return; } - DataForChunk(Chunk).WireStates[Position] = Block; + DataForChunk(Chunk).WireStates.emplace(Position, Block); } inline PowerLevel GetPowerDeliveredToPosition(const cChunk & a_Chunk, Vector3i a_Position, BLOCKTYPE a_BlockType, Vector3i a_QueryPosition, BLOCKTYPE a_QueryBlockType, bool IsLinked) |