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:
Jonathan G Rennison
2015-11-30 22:28:20 +00:00
parent d05f67cf5a
commit a7e9c9ce65
4 changed files with 9 additions and 9 deletions

View File

@@ -209,7 +209,7 @@ uint Vehicle::Crash(bool flooded)
v->MarkAllViewportsDirty();
}
if (_settings_game.order.timetable_separation) this->ClearSeparation();
this->ClearSeparation();
if (_settings_game.order.timetable_separation) ClrBit(this->vehicle_flags, VF_TIMETABLE_STARTED);
/* Dirty some windows */
@@ -2230,7 +2230,7 @@ CommandCost Vehicle::SendToDepot(DoCommandFlag flags, DepotCommand command)
if (flags & DC_EXEC) {
this->current_order.SetDepotOrderType(ODTF_MANUAL);
this->current_order.SetDepotActionType(halt_in_depot ? ODATF_SERVICE_ONLY : ODATFB_HALT);
if (_settings_game.order.timetable_separation) this->ClearSeparation();
this->ClearSeparation();
if (_settings_game.order.timetable_separation) ClrBit(this->vehicle_flags, VF_TIMETABLE_STARTED);
SetWindowWidgetDirty(WC_VEHICLE_VIEW, this->index, WID_VV_START_STOP);
}
@@ -2248,7 +2248,7 @@ CommandCost Vehicle::SendToDepot(DoCommandFlag flags, DepotCommand command)
SetBit(gv_flags, GVF_SUPPRESS_IMPLICIT_ORDERS);
}
if (_settings_game.order.timetable_separation) this->ClearSeparation();
this->ClearSeparation();
if (_settings_game.order.timetable_separation) ClrBit(this->vehicle_flags, VF_TIMETABLE_STARTED);
this->current_order.MakeDummy();
@@ -2701,7 +2701,7 @@ void Vehicle::RemoveFromShared()
this->next_shared = NULL;
this->previous_shared = NULL;
if (_settings_game.order.timetable_separation) this->ClearSeparation();
this->ClearSeparation();
if (_settings_game.order.timetable_separation) ClrBit(this->vehicle_flags, VF_TIMETABLE_STARTED);
}