966 { |
966 { |
967 Vehicle *v; |
967 Vehicle *v; |
968 Order *order; |
968 Order *order; |
969 bool need_invalidate; |
969 bool need_invalidate; |
970 |
970 |
|
971 /* Aircraft have StationIDs for depot orders and never use DepotIDs |
|
972 * This fact is handled specially below |
|
973 */ |
|
974 |
971 /* Go through all vehicles */ |
975 /* Go through all vehicles */ |
972 FOR_ALL_VEHICLES(v) { |
976 FOR_ALL_VEHICLES(v) { |
973 if (v->orders == NULL) continue; |
977 if (v->orders == NULL) continue; |
974 |
978 |
975 /* Forget about this station if this station is removed */ |
979 /* Forget about this station if this station is removed */ |
976 if (v->last_station_visited == destination && type == OT_GOTO_STATION) |
980 if (v->last_station_visited == destination && type == OT_GOTO_STATION) |
977 v->last_station_visited = INVALID_STATION; |
981 v->last_station_visited = INVALID_STATION; |
978 |
982 |
979 /* Check the current order */ |
983 /* Check the current order */ |
980 if (v->current_order.type == type && v->current_order.dest == destination) { |
984 if ((v->type == VEH_Aircraft && v->current_order.type == OT_GOTO_DEPOT ? OT_GOTO_STATION : v->current_order.type) == type && |
|
985 v->current_order.dest == destination) { |
981 /* Mark the order as DUMMY */ |
986 /* Mark the order as DUMMY */ |
982 v->current_order.type = OT_DUMMY; |
987 v->current_order.type = OT_DUMMY; |
983 v->current_order.flags = 0; |
988 v->current_order.flags = 0; |
984 InvalidateWindow(WC_VEHICLE_VIEW, v->index); |
989 InvalidateWindow(WC_VEHICLE_VIEW, v->index); |
985 } |
990 } |
986 |
991 |
987 /* Clear the order from the order-list */ |
992 /* Clear the order from the order-list */ |
988 need_invalidate = false; |
993 need_invalidate = false; |
989 FOR_VEHICLE_ORDERS(v, order) { |
994 FOR_VEHICLE_ORDERS(v, order) { |
990 if (order->type == type && order->dest == destination) { |
995 if ((v->type == VEH_Aircraft && order->type == OT_GOTO_DEPOT ? OT_GOTO_STATION : order->type) == type && |
|
996 order->dest == destination) { |
991 /* Mark the order as DUMMY */ |
997 /* Mark the order as DUMMY */ |
992 order->type = OT_DUMMY; |
998 order->type = OT_DUMMY; |
993 order->flags = 0; |
999 order->flags = 0; |
994 |
1000 |
995 need_invalidate = true; |
1001 need_invalidate = true; |