diff options
author | madmaxoft <github@xoft.cz> | 2014-06-14 18:16:10 +0200 |
---|---|---|
committer | madmaxoft <github@xoft.cz> | 2014-06-14 18:16:10 +0200 |
commit | a89422ea4c5859464a9d955675ca666b67453190 (patch) | |
tree | 94c3a9546b02455691ba2702aec495233fd86d95 /src/Entities | |
parent | Refactored speed-setting to use a common function for all cases. (diff) | |
download | cuberite-a89422ea4c5859464a9d955675ca666b67453190.tar cuberite-a89422ea4c5859464a9d955675ca666b67453190.tar.gz cuberite-a89422ea4c5859464a9d955675ca666b67453190.tar.bz2 cuberite-a89422ea4c5859464a9d955675ca666b67453190.tar.lz cuberite-a89422ea4c5859464a9d955675ca666b67453190.tar.xz cuberite-a89422ea4c5859464a9d955675ca666b67453190.tar.zst cuberite-a89422ea4c5859464a9d955675ca666b67453190.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Entities/Entity.cpp | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp index 76bd11406..ee7ce06ac 100644 --- a/src/Entities/Entity.cpp +++ b/src/Entities/Entity.cpp @@ -179,14 +179,9 @@ void cEntity::WrapRotation(void) void cEntity::WrapSpeed(void) { - // There shoudn't be a need for flipping the flag on because this function is called - // after any update, so the flag is already turned on - if (m_Speed.x > 78.0f) m_Speed.x = 78.0f; - else if (m_Speed.x < -78.0f) m_Speed.x = -78.0f; - if (m_Speed.y > 78.0f) m_Speed.y = 78.0f; - else if (m_Speed.y < -78.0f) m_Speed.y = -78.0f; - if (m_Speed.z > 78.0f) m_Speed.z = 78.0f; - else if (m_Speed.z < -78.0f) m_Speed.z = -78.0f; + m_Speed.x = Clamp(m_Speed.x, -78.0, 78.0); + m_Speed.y = Clamp(m_Speed.y, -78.0, 78.0); + m_Speed.z = Clamp(m_Speed.z, -78.0, 78.0); } |