From a431b45641d119a91a74cd88768389eebeb54a68 Mon Sep 17 00:00:00 2001 From: LogicParrot Date: Tue, 5 Apr 2016 11:45:09 +0300 Subject: Improved player freeze code --- src/Chunk.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'src/Chunk.cpp') diff --git a/src/Chunk.cpp b/src/Chunk.cpp index c1baae9b2..bc0de0516 100644 --- a/src/Chunk.cpp +++ b/src/Chunk.cpp @@ -604,7 +604,19 @@ void cChunk::SpawnMobs(cMobSpawner & a_MobSpawner) void cChunk::Tick(std::chrono::milliseconds a_Dt) { - m_IsInTick = true; + // If we are not valid, tick players and bailout + if (!IsValid()) + { + for (auto Entity : m_Entities) + { + if (Entity->IsPlayer()) + { + Entity->Tick(a_Dt, *this); + } + } + return; + } + BroadcastPendingBlockChanges(); CheckBlocks(); @@ -668,7 +680,6 @@ void cChunk::Tick(std::chrono::milliseconds a_Dt) } // for itr - m_Entitites[] ApplyWeatherToTop(); - m_IsInTick = false; } -- cgit v1.2.3