Fix ClearSeparation() not being called when auto-separation disabled.
This can causes crashes if auto-separation is re-enabled as the next/prev separation ptrs can end up dangling.
This commit is contained in:
@@ -591,7 +591,7 @@ void UpdateVehicleTimetable(Vehicle *v, bool travelling)
|
||||
|
||||
/* Start automated timetables at first opportunity */
|
||||
if (!HasBit(v->vehicle_flags, VF_TIMETABLE_STARTED) && HasBit(v->vehicle_flags, VF_AUTOMATE_TIMETABLE)) {
|
||||
if (_settings_game.order.timetable_separation) v->ClearSeparation();
|
||||
v->ClearSeparation();
|
||||
SetBit(v->vehicle_flags, VF_TIMETABLE_STARTED);
|
||||
v->lateness_counter = 0;
|
||||
if (_settings_game.order.timetable_separation) UpdateSeparationOrder(v);
|
||||
@@ -680,7 +680,7 @@ void UpdateVehicleTimetable(Vehicle *v, bool travelling)
|
||||
* Otherwise we risk trains blocking 1-lane stations for long times. */
|
||||
ChangeTimetable(v, v->cur_real_order_index, 0, travelling ? MTF_TRAVEL_TIME : MTF_WAIT_TIME, true);
|
||||
for (Vehicle *v2 = v->FirstShared(); v2 != NULL; v2 = v2->NextShared()) {
|
||||
if (_settings_game.order.timetable_separation) v2->ClearSeparation();
|
||||
v2->ClearSeparation();
|
||||
ClrBit(v2->vehicle_flags, VF_TIMETABLE_STARTED);
|
||||
SetWindowDirty(WC_VEHICLE_TIMETABLE, v2->index);
|
||||
}
|
||||
|
Reference in New Issue
Block a user