summaryrefslogtreecommitdiffstats
path: root/src/Chunk.cpp
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@outlook.com>2020-07-29 19:51:39 +0200
committerTiger Wang <ziwei.tiger@outlook.com>2020-08-02 16:52:06 +0200
commitb205d233bdd34e26d6bde31879c10b6cabf820b6 (patch)
tree29919857422e924139e4345ebe029f06740e043a /src/Chunk.cpp
parentRemove unused block tick related cChunk functions (diff)
downloadcuberite-b205d233bdd34e26d6bde31879c10b6cabf820b6.tar
cuberite-b205d233bdd34e26d6bde31879c10b6cabf820b6.tar.gz
cuberite-b205d233bdd34e26d6bde31879c10b6cabf820b6.tar.bz2
cuberite-b205d233bdd34e26d6bde31879c10b6cabf820b6.tar.lz
cuberite-b205d233bdd34e26d6bde31879c10b6cabf820b6.tar.xz
cuberite-b205d233bdd34e26d6bde31879c10b6cabf820b6.tar.zst
cuberite-b205d233bdd34e26d6bde31879c10b6cabf820b6.zip
Diffstat (limited to 'src/Chunk.cpp')
-rw-r--r--src/Chunk.cpp18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/Chunk.cpp b/src/Chunk.cpp
index e4a4dd661..2140bf7f1 100644
--- a/src/Chunk.cpp
+++ b/src/Chunk.cpp
@@ -812,23 +812,21 @@ void cChunk::BroadcastPendingBlockChanges(void)
void cChunk::CheckBlocks()
{
- if (m_ToTickBlocks.empty())
- {
- return;
- }
- std::vector<Vector3i> ToTickBlocks;
- std::swap(m_ToTickBlocks, ToTickBlocks);
-
cChunkInterface ChunkInterface(m_World->GetChunkMap());
cBlockInServerPluginInterface PluginInterface(*m_World);
- for (std::vector<Vector3i>::const_iterator itr = ToTickBlocks.begin(), end = ToTickBlocks.end(); itr != end; ++itr)
+ // Process a limited number of blocks since cBlockHandler::Check may queue more to tick
+ auto Count = m_ToTickBlocks.size();
+
+ while (Count != 0)
{
- Vector3i Pos = (*itr);
+ Vector3i Pos = m_ToTickBlocks.front();
+ m_ToTickBlocks.pop();
+ Count--;
cBlockHandler * Handler = BlockHandler(GetBlock(Pos));
Handler->Check(ChunkInterface, PluginInterface, Pos, *this);
- } // for itr - ToTickBlocks[]
+ }
}