From 7a73fd467cfadfe3b3a5cf43d3eea9392f4c7f34 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Tue, 8 Nov 2022 22:14:45 +0000 Subject: Protocol: Use correct calculation for delta movements (#5455) * Protocol: Use correct calculation for delta movements --- src/Entities/Entity.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/Entities/Entity.cpp') diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp index 0718da06c..c46f9e644 100644 --- a/src/Entities/Entity.cpp +++ b/src/Entities/Entity.cpp @@ -1970,7 +1970,7 @@ void cEntity::BroadcastMovementUpdate(const cClientHandle * a_Exclude) return; } - if (GetSpeed().SqrLength() > 0.001) + if (m_Speed.HasNonZeroLength()) { // Movin' m_World->BroadcastEntityVelocity(*this, a_Exclude); @@ -1986,8 +1986,7 @@ void cEntity::BroadcastMovementUpdate(const cClientHandle * a_Exclude) m_bHasSentNoSpeed = true; } - Vector3i Diff = (GetPosition() * 32.0).Floor() - (m_LastSentPosition * 32.0).Floor(); - if (Diff.HasNonZeroLength()) // Have we moved? + if ((m_Position - m_LastSentPosition).HasNonZeroLength()) // Have we moved? { m_World->BroadcastEntityPosition(*this, a_Exclude); -- cgit v1.2.3