From be2bf999c280d6892b38272d3f783b3462f0b745 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Sat, 6 Feb 2021 18:37:03 +0000 Subject: Fix #5118 --- src/Entities/Minecart.cpp | 37 +++---------------------------------- 1 file changed, 3 insertions(+), 34 deletions(-) (limited to 'src/Entities/Minecart.cpp') diff --git a/src/Entities/Minecart.cpp b/src/Entities/Minecart.cpp index 3ddcea6ee..96eebe2fd 100644 --- a/src/Entities/Minecart.cpp +++ b/src/Entities/Minecart.cpp @@ -216,6 +216,9 @@ void cMinecart::HandlePhysics(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) m_DetectorRailPosition = Vector3i(POSX_TOINT, POSY_TOINT, POSZ_TOINT); } + // Enforce speed limit: + m_Speed.Clamp(MAX_SPEED_NEGATIVE, MAX_SPEED); + // Broadcast positioning changes to client BroadcastMovementUpdate(); } @@ -1268,40 +1271,6 @@ void cMinecart::ApplyAcceleration(Vector3d a_ForwardDirection, double a_Accelera -void cMinecart::DoSetSpeed(double a_SpeedX, double a_SpeedY, double a_SpeedZ) -{ - if (a_SpeedX > MAX_SPEED) - { - a_SpeedX = MAX_SPEED; - } - else if (a_SpeedX < MAX_SPEED_NEGATIVE) - { - a_SpeedX = MAX_SPEED_NEGATIVE; - } - if (a_SpeedY > MAX_SPEED) - { - a_SpeedY = MAX_SPEED; - } - else if (a_SpeedY < MAX_SPEED_NEGATIVE) - { - a_SpeedY = MAX_SPEED_NEGATIVE; - } - if (a_SpeedZ > MAX_SPEED) - { - a_SpeedZ = MAX_SPEED; - } - else if (a_SpeedZ < MAX_SPEED_NEGATIVE) - { - a_SpeedZ = MAX_SPEED_NEGATIVE; - } - - Super::DoSetSpeed(a_SpeedX, a_SpeedY, a_SpeedZ); -} - - - - - //////////////////////////////////////////////////////////////////////////////// // cRideableMinecart: -- cgit v1.2.3