From 957b7c0199e6cb6d3230bc552effb73241a1aeab Mon Sep 17 00:00:00 2001 From: fonsinchen Date: Sat, 17 May 2014 19:38:30 +0000 Subject: [PATCH] (svn r26594) -Fix [FS#6006]: Don't call UpdateVehicleTimetable with dummy orders --- src/vehicle.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/vehicle.cpp b/src/vehicle.cpp index edfbee499e..4cf6e642e1 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 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(); } }