summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfonsinchen <fonsinchen@openttd.org>2014-05-17 19:38:30 +0000
committerfonsinchen <fonsinchen@openttd.org>2014-05-17 19:38:30 +0000
commita9e3828dd2f6d6d0b94322f24b98a9dc76d4901c (patch)
tree72deaa7f633eef031115fb13fff4251797be6e48 /src
parent2a4f0fb67df748992213cd620c65ba8beaa5bd4e (diff)
downloadopenttd-a9e3828dd2f6d6d0b94322f24b98a9dc76d4901c.tar.xz
(svn r26594) -Fix [FS#6006]: Don't call UpdateVehicleTimetable with dummy orders
Diffstat (limited to 'src')
-rw-r--r--src/vehicle.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/vehicle.cpp b/src/vehicle.cpp
index edfbee499..4cf6e642e 100644
--- a/src/vehicle.cpp
+++ b/src/vehicle.cpp
@@ -1403,21 +1403,19 @@ void VehicleEnterDepot(Vehicle *v)
SetWindowDirty(WC_VEHICLE_VIEW, v->index);
const Order *real_order = v->GetOrder(v->cur_real_order_index);
- Order t = v->current_order;
- v->current_order.MakeDummy();
/* Test whether we are heading for this depot. If not, do nothing.
* Note: The target depot for nearest-/manual-depot-orders is only updated on junctions, but we want to accept every depot. */
- if ((t.GetDepotOrderType() & ODTFB_PART_OF_ORDERS) &&
+ if ((v->current_order.GetDepotOrderType() & ODTFB_PART_OF_ORDERS) &&
real_order != NULL && !(real_order->GetDepotActionType() & ODATFB_NEAREST_DEPOT) &&
- (v->type == VEH_AIRCRAFT ? t.GetDestination() != GetStationIndex(v->tile) : v->dest_tile != v->tile)) {
+ (v->type == VEH_AIRCRAFT ? v->current_order.GetDestination() != GetStationIndex(v->tile) : v->dest_tile != v->tile)) {
/* We are heading for another depot, keep driving. */
return;
}
- if (t.IsRefit()) {
+ if (v->current_order.IsRefit()) {
Backup<CompanyByte> cur_company(_current_company, v->owner, FILE_LINE);
- CommandCost cost = DoCommand(v->tile, v->index, t.GetRefitCargo() | 0xFF << 8, DC_EXEC, GetCmdRefitVeh(v));
+ CommandCost cost = DoCommand(v->tile, v->index, v->current_order.GetRefitCargo() | 0xFF << 8, DC_EXEC, GetCmdRefitVeh(v));
cur_company.Restore();
if (cost.Failed()) {
@@ -1435,13 +1433,13 @@ void VehicleEnterDepot(Vehicle *v)
}
}
- if (t.GetDepotOrderType() & ODTFB_PART_OF_ORDERS) {
+ if (v->current_order.GetDepotOrderType() & ODTFB_PART_OF_ORDERS) {
/* Part of orders */
v->DeleteUnreachedImplicitOrders();
UpdateVehicleTimetable(v, true);
v->IncrementImplicitOrderIndex();
}
- if (t.GetDepotActionType() & ODATFB_HALT) {
+ if (v->current_order.GetDepotActionType() & ODATFB_HALT) {
/* Vehicles are always stopped on entering depots. Do not restart this one. */
_vehicles_to_autoreplace[v] = false;
/* Invalidate last_loading_station. As the link from the station
@@ -1454,6 +1452,7 @@ void VehicleEnterDepot(Vehicle *v)
}
AI::NewEvent(v->owner, new ScriptEventVehicleWaitingInDepot(v->index));
}
+ v->current_order.MakeDummy();
}
}