mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-06 06:32:56 +01:00
Merge pull request #24629 from janisozaur/hired-boat-division-by-zero
Fix #24617: Prevent hired boat with 0 speed causing division by 0
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
- Fix: [#24576] It is possible to edit open rides in certain circumstances.
|
||||
- Fix: [#24589] Music tab doesn’t fully render in multiplayer.
|
||||
- Fix: [#24615] Blank strings in Windows installer.
|
||||
- Fix: [#24617] ‘Divide by zero’ error when updating boat hire acceleration.
|
||||
|
||||
0.4.23 (2025-06-07)
|
||||
------------------------------------------------------------------------
|
||||
|
||||
@@ -3909,7 +3909,7 @@ void Vehicle::UpdateMotionBoatHire()
|
||||
int32_t curMass = mass == 0 ? 1 : mass;
|
||||
|
||||
int32_t eax = ((velocity >> 1) + edx) / curMass;
|
||||
int32_t ecx = -eax;
|
||||
int32_t newAcceleration = -eax;
|
||||
if (carEntry->flags & CAR_ENTRY_FLAG_POWERED)
|
||||
{
|
||||
eax = speed << 14;
|
||||
@@ -3920,9 +3920,12 @@ void Vehicle::UpdateMotionBoatHire()
|
||||
}
|
||||
eax -= velocity;
|
||||
edx = powered_acceleration * 2;
|
||||
ecx += (eax * edx) / ebx;
|
||||
if (ebx != 0)
|
||||
{
|
||||
newAcceleration += (eax * edx) / ebx;
|
||||
}
|
||||
}
|
||||
acceleration = ecx;
|
||||
acceleration = newAcceleration;
|
||||
}
|
||||
// eax = _vehicleMotionTrackFlags;
|
||||
// ebx = _vehicleStationIndex;
|
||||
|
||||
Reference in New Issue
Block a user