aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorariel- <ariel-@users.noreply.github.com>2016-12-11 17:37:43 -0300
committerDoctorKraft <DoctorKraft@users.noreply.github.com>2018-03-12 16:39:37 +0100
commit5e0e5a5573cd31e935b9f9b19311523ea0447674 (patch)
tree8986a4223d38ff02885d90bfb030bf99e92996ec
parentf07a746321dce26381e3d14456ab22839ddc6861 (diff)
Core/Entities: don't absolute compare positions on UpdatePosition
Closes #18415 (cherry picked from commit 45f8135ac45799e555449bebb6d2a78869a439b6)
-rw-r--r--src/server/game/Entities/Unit/Unit.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index a39c25327c0..6dbad26a75d 100644
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -13035,8 +13035,13 @@ bool Unit::UpdatePosition(float x, float y, float z, float orientation, bool tel
return false;
}
- bool turn = (GetOrientation() != orientation);
- bool relocated = (teleport || GetPositionX() != x || GetPositionY() != y || GetPositionZ() != z);
+ bool const turn = (GetOrientation() != orientation);
+
+ // G3D::fuzzyEq won't help here, in some cases magnitudes differ by a little more than G3D::eps, but should be considered equal
+ bool const relocated = (teleport ||
+ std::fabs(GetPositionX() - x) > 0.001f ||
+ std::fabs(GetPositionY() - y) > 0.001f ||
+ std::fabs(GetPositionZ() - z) > 0.001f);
// TODO: Check if orientation transport offset changed instead of only global orientation
if (turn)