diff options
Diffstat (limited to '')
-rw-r--r-- | src/Simulator/IncrementalRedstoneSimulator/RedstoneSimulatorChunkData.h | 3 | ||||
-rw-r--r-- | src/Simulator/SandSimulator.cpp | 46 | ||||
-rw-r--r-- | src/Simulator/SandSimulator.h | 4 |
3 files changed, 26 insertions, 27 deletions
diff --git a/src/Simulator/IncrementalRedstoneSimulator/RedstoneSimulatorChunkData.h b/src/Simulator/IncrementalRedstoneSimulator/RedstoneSimulatorChunkData.h index 2d2010d57..02da327a1 100644 --- a/src/Simulator/IncrementalRedstoneSimulator/RedstoneSimulatorChunkData.h +++ b/src/Simulator/IncrementalRedstoneSimulator/RedstoneSimulatorChunkData.h @@ -67,8 +67,7 @@ public: return 0; } - std::swap(Result->second, Power); - return Power; + return std::exchange(Result->second, Power); } /** Adjust From-relative coordinates into To-relative coordinates. */ diff --git a/src/Simulator/SandSimulator.cpp b/src/Simulator/SandSimulator.cpp index 95f514cc9..72b1a8378 100644 --- a/src/Simulator/SandSimulator.cpp +++ b/src/Simulator/SandSimulator.cpp @@ -74,29 +74,6 @@ void cSandSimulator::SimulateChunk(std::chrono::milliseconds a_Dt, int a_ChunkX, -bool cSandSimulator::IsAllowedBlock(BLOCKTYPE a_BlockType) -{ - switch (a_BlockType) - { - case E_BLOCK_ANVIL: - case E_BLOCK_CONCRETE_POWDER: - case E_BLOCK_DRAGON_EGG: - case E_BLOCK_GRAVEL: - case E_BLOCK_SAND: - { - return true; - } - default: - { - return false; - } - } -} - - - - - void cSandSimulator::AddBlock(cChunk & a_Chunk, Vector3i a_Position, BLOCKTYPE a_Block) { if (!IsAllowedBlock(a_Block)) @@ -286,6 +263,29 @@ void cSandSimulator::FinishFalling( +bool cSandSimulator::IsAllowedBlock(BLOCKTYPE a_BlockType) +{ + switch (a_BlockType) + { + case E_BLOCK_ANVIL: + case E_BLOCK_CONCRETE_POWDER: + case E_BLOCK_DRAGON_EGG: + case E_BLOCK_GRAVEL: + case E_BLOCK_SAND: + { + return true; + } + default: + { + return false; + } + } +} + + + + + void cSandSimulator::DoInstantFall(cChunk * a_Chunk, int a_RelX, int a_RelY, int a_RelZ) { // Remove the original block: diff --git a/src/Simulator/SandSimulator.h b/src/Simulator/SandSimulator.h index 113484158..e05b0de80 100644 --- a/src/Simulator/SandSimulator.h +++ b/src/Simulator/SandSimulator.h @@ -51,13 +51,13 @@ public: BLOCKTYPE a_FallingBlockType, NIBBLETYPE a_FallingBlockMeta ); + static bool IsAllowedBlock(BLOCKTYPE a_BlockType); + private: virtual void Simulate(float a_Dt) override { UNUSED(a_Dt);} // not used virtual void SimulateChunk(std::chrono::milliseconds a_Dt, int a_ChunkX, int a_ChunkZ, cChunk * a_Chunk) override; - static bool IsAllowedBlock(BLOCKTYPE a_BlockType); - bool m_IsInstantFall; // If set to true, blocks don't fall using cFallingBlock entity, but instantly instead int m_TotalBlocks; // Total number of blocks currently in the queue for simulating |