diff options
author | Tiger Wang <ziwei.tiger@outlook.com> | 2020-07-29 20:30:38 +0200 |
---|---|---|
committer | Tiger Wang <ziwei.tiger@outlook.com> | 2020-08-04 19:15:18 +0200 |
commit | 6bdd130aab51b630918ed664c4389cf33bcb2e06 (patch) | |
tree | eed35c8716f9ea18afe8fd909c09e8595928a671 /src/Chunk.cpp | |
parent | Do not GetBlock individually in simulators (diff) | |
download | cuberite-6bdd130aab51b630918ed664c4389cf33bcb2e06.tar cuberite-6bdd130aab51b630918ed664c4389cf33bcb2e06.tar.gz cuberite-6bdd130aab51b630918ed664c4389cf33bcb2e06.tar.bz2 cuberite-6bdd130aab51b630918ed664c4389cf33bcb2e06.tar.lz cuberite-6bdd130aab51b630918ed664c4389cf33bcb2e06.tar.xz cuberite-6bdd130aab51b630918ed664c4389cf33bcb2e06.tar.zst cuberite-6bdd130aab51b630918ed664c4389cf33bcb2e06.zip |
Diffstat (limited to 'src/Chunk.cpp')
-rw-r--r-- | src/Chunk.cpp | 33 |
1 files changed, 3 insertions, 30 deletions
diff --git a/src/Chunk.cpp b/src/Chunk.cpp index 2140bf7f1..21261e828 100644 --- a/src/Chunk.cpp +++ b/src/Chunk.cpp @@ -820,7 +820,7 @@ void cChunk::CheckBlocks() while (Count != 0) { - Vector3i Pos = m_ToTickBlocks.front(); + const auto Pos = m_ToTickBlocks.front(); m_ToTickBlocks.pop(); Count--; @@ -1263,8 +1263,8 @@ void cChunk::SetBlock(Vector3i a_RelPos, BLOCKTYPE a_BlockType, NIBBLETYPE a_Blo { FastSetBlock(a_RelPos, a_BlockType, a_BlockMeta); - // Tick this block and its neighbors: - QueueTickBlockNeighbors(a_RelPos); + // Tick this block's neighbors via cBlockHandler::Check: + m_ToTickBlocks.push(a_RelPos); // Wake up the simulators for this block: GetWorld()->GetSimulatorManager()->WakeUp(*this, a_RelPos); @@ -1311,33 +1311,6 @@ void cChunk::SetBlock(Vector3i a_RelPos, BLOCKTYPE a_BlockType, NIBBLETYPE a_Blo -void cChunk::QueueTickBlockNeighbors(Vector3i a_Position) -{ - m_ToTickBlocks.push(a_Position); - - for (const auto & Offset : cSimulator::AdjacentOffsets) - { - auto Relative = a_Position + Offset; - - if (!cChunkDef::IsValidHeight(Relative.y)) - { - continue; - } - - auto Chunk = GetRelNeighborChunkAdjustCoords(Relative); - if ((Chunk == nullptr) || !Chunk->IsValid()) - { - continue; - } - - Chunk->m_ToTickBlocks.push(Relative); - } -} - - - - - void cChunk::FastSetBlock(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockType, BLOCKTYPE a_BlockMeta, bool a_SendToClients) { ASSERT(!((a_RelX < 0) || (a_RelX >= Width) || (a_RelY < 0) || (a_RelY >= Height) || (a_RelZ < 0) || (a_RelZ >= Width))); |