Fix division by zero when wrapping lateness_counter with 0 timetable duration
This commit is contained in:
@@ -1044,9 +1044,13 @@ void UpdateVehicleTimetable(Vehicle *v, bool travelling)
|
||||
if (v->lateness_counter > (int)timetabled) {
|
||||
Ticks cycle = v->orders->GetTimetableTotalDuration();
|
||||
if (cycle != INVALID_TICKS && v->lateness_counter > cycle) {
|
||||
if (cycle == 0) {
|
||||
v->lateness_counter = 0;
|
||||
} else {
|
||||
v->lateness_counter %= cycle;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SetTimetableWindowsDirty(v);
|
||||
}
|
||||
|
Reference in New Issue
Block a user