From 5907df680861e19091018c33979ebabe53d7ed72 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Thu, 3 Nov 2022 00:52:37 +0000 Subject: Chunk: Optimise idle ticking * Instead of chunks ticking player objects, and the player object in turn ticking its client handle, let the world tick the client handles. This means we no longer need to maintain a special-case for chunks that shouldn't be ticking, but still need to process players. Partially reverts to the state before 054a89dd. --- src/ChunkMap.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/ChunkMap.cpp') diff --git a/src/ChunkMap.cpp b/src/ChunkMap.cpp index 16e8fa267..7dd7901fd 100644 --- a/src/ChunkMap.cpp +++ b/src/ChunkMap.cpp @@ -1347,7 +1347,10 @@ void cChunkMap::Tick(std::chrono::milliseconds a_Dt) // Do the magic of updating the world: for (auto & Chunk : m_Chunks) { - Chunk.second.Tick(a_Dt); + if (Chunk.second.ShouldBeTicked()) + { + Chunk.second.Tick(a_Dt); + } } // Finally, only after all chunks are ticked, tell the client about all aggregated changes: -- cgit v1.2.3