Don't crash when vehicles have 0 friction (#3615)

This commit is contained in:
janisozaur 2016-05-15 16:59:42 +02:00 committed by Ted John
parent 3a6978a9aa
commit b3101dd9b0
1 changed files with 4 additions and 1 deletions

View File

@ -8168,7 +8168,10 @@ int vehicle_update_track_motion(rct_vehicle *vehicle, int *outStation)
}
regs.edx >>= 4;
regs.eax = regs.edx;
regs.eax = regs.eax / totalFriction;
// OpenRCT2: vehicles from different track types can have 0 friction.
if (totalFriction != 0) {
regs.eax = regs.eax / totalFriction;
}
regs.ecx -= regs.eax;
if (!(vehicleEntry->flags_b & VEHICLE_ENTRY_FLAG_B_3)) {