diff options
author | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2014-06-29 23:41:31 +0200 |
---|---|---|
committer | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2014-06-29 23:41:31 +0200 |
commit | 428cfb5c21ec5a35252b967eb306d6ba9b8e11b3 (patch) | |
tree | a0b3e28ea6d4b9deb4c063449afe7d5e78f38ff3 /src/Entities/Entity.cpp | |
parent | An unification of code style (diff) | |
download | cuberite-428cfb5c21ec5a35252b967eb306d6ba9b8e11b3.tar cuberite-428cfb5c21ec5a35252b967eb306d6ba9b8e11b3.tar.gz cuberite-428cfb5c21ec5a35252b967eb306d6ba9b8e11b3.tar.bz2 cuberite-428cfb5c21ec5a35252b967eb306d6ba9b8e11b3.tar.lz cuberite-428cfb5c21ec5a35252b967eb306d6ba9b8e11b3.tar.xz cuberite-428cfb5c21ec5a35252b967eb306d6ba9b8e11b3.tar.zst cuberite-428cfb5c21ec5a35252b967eb306d6ba9b8e11b3.zip |
Diffstat (limited to 'src/Entities/Entity.cpp')
-rw-r--r-- | src/Entities/Entity.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp index f4e89367b..1683aa209 100644 --- a/src/Entities/Entity.cpp +++ b/src/Entities/Entity.cpp @@ -255,7 +255,8 @@ void cEntity::TakeDamage(eDamageType a_DamageType, cEntity * a_Attacker, int a_R void cEntity::SetYawFromSpeed(void) { - if ((abs(m_Speed.x) < std::numeric_limits<double>::epsilon()) && (abs(m_Speed.z) < std::numeric_limits<double>::epsilon())) + const double EPS = 0.0000001; + if ((abs(m_Speed.x) < EPS) && (abs(m_Speed.z) < EPS)) { // atan2() may overflow or is undefined, pick any number SetYaw(0); @@ -1235,7 +1236,7 @@ void cEntity::BroadcastMovementUpdate(const cClientHandle * a_Exclude) if (GetWorld()->GetWorldAge() % 2 == 0) { double SpeedSqr = GetSpeed().SqrLength(); - if (SpeedSqr < std::numeric_limits<double>::epsilon()) + if (SpeedSqr == 0.0) { // Speed is zero, send this to clients once only as well as an absolute position if (!m_bHasSentNoSpeed) |