1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-15 11:03:00 +01:00

Merge pull request #14034 from Gymnasiast/fix/12939

Fix #12939: divide-by-0 in Vehicle::UpdateMotionDodgems()
This commit is contained in:
Michael Steenbeek
2021-02-09 22:18:49 +01:00
committed by GitHub

View File

@@ -6468,7 +6468,7 @@ int32_t Vehicle::UpdateMotionDodgems()
return _vehicleMotionTrackFlags;
}
int32_t ebx = (speed * mass) >> 2;
int32_t momentum = (speed * mass) >> 2;
int32_t _eax = speed << 14;
if (HasUpdateFlag(VEHICLE_UPDATE_FLAG_REVERSING_SHUTTLE))
{
@@ -6476,7 +6476,8 @@ int32_t Vehicle::UpdateMotionDodgems()
}
_eax -= velocity;
_eax *= powered_acceleration * 2;
_eax /= ebx;
if (momentum != 0)
_eax /= momentum;
acceleration = _eax - eax;
return _vehicleMotionTrackFlags;