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/World.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/World.cpp') diff --git a/src/World.cpp b/src/World.cpp index 57ba656e8..1af7650e6 100644 --- a/src/World.cpp +++ b/src/World.cpp @@ -1033,6 +1033,7 @@ void cWorld::Tick(std::chrono::milliseconds a_Dt, std::chrono::milliseconds a_La Player->GetClientHandle()->ProcessProtocolIn(); } + TickClients(a_Dt); TickQueuedChunkDataSets(); TickQueuedBlocks(); m_ChunkMap.Tick(a_Dt); @@ -1072,6 +1073,18 @@ void cWorld::Tick(std::chrono::milliseconds a_Dt, std::chrono::milliseconds a_La +void cWorld::TickClients(const std::chrono::milliseconds a_Dt) +{ + for (const auto Player : m_Players) + { + Player->GetClientHandle()->Tick(a_Dt); + } +} + + + + + void cWorld::TickWeather(float a_Dt) { UNUSED(a_Dt); -- cgit v1.2.3