mirror of https://github.com/OpenTTD/OpenTTD
(svn r16475) -Codechange: move code invalidating Vehicle::last_station_visited to more logical place
parent
0eaec8edca
commit
ab5a51d462
|
@ -1458,11 +1458,6 @@ void RemoveOrderFromAllVehicles(OrderType type, DestinationID destination)
|
||||||
FOR_ALL_VEHICLES(v) {
|
FOR_ALL_VEHICLES(v) {
|
||||||
Order *order;
|
Order *order;
|
||||||
|
|
||||||
/* Forget about this station if this station is removed */
|
|
||||||
if (v->last_station_visited == destination && type == OT_GOTO_STATION) {
|
|
||||||
v->last_station_visited = INVALID_STATION;
|
|
||||||
}
|
|
||||||
|
|
||||||
order = &v->current_order;
|
order = &v->current_order;
|
||||||
if ((v->type == VEH_AIRCRAFT && order->IsType(OT_GOTO_DEPOT) ? OT_GOTO_STATION : order->GetType()) == type &&
|
if ((v->type == VEH_AIRCRAFT && order->IsType(OT_GOTO_DEPOT) ? OT_GOTO_STATION : order->GetType()) == type &&
|
||||||
v->current_order.GetDestination() == destination) {
|
v->current_order.GetDestination() == destination) {
|
||||||
|
|
|
@ -75,6 +75,14 @@ Station::~Station()
|
||||||
if (a->targetairport == this->index) a->targetairport = INVALID_STATION;
|
if (a->targetairport == this->index) a->targetairport = INVALID_STATION;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Vehicle *v;
|
||||||
|
FOR_ALL_VEHICLES(v) {
|
||||||
|
/* Forget about this station if this station is removed */
|
||||||
|
if (v->last_station_visited == destination && type == OT_GOTO_STATION) {
|
||||||
|
v->last_station_visited = INVALID_STATION;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
MarkDirty();
|
MarkDirty();
|
||||||
InvalidateWindowData(WC_STATION_LIST, this->owner, 0);
|
InvalidateWindowData(WC_STATION_LIST, this->owner, 0);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue