summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2009-05-04 19:27:22 +0000
committerfrosch <frosch@openttd.org>2009-05-04 19:27:22 +0000
commit9023c24acfd618e1407d7f00179512900ae704c5 (patch)
treec36c6e2b723fcb9a1031b23a1024d2d799661a48
parent34066a60272e65bf6c8a966e50474ec69ccef374 (diff)
downloadopenttd-9023c24acfd618e1407d7f00179512900ae704c5.tar.xz
(svn r16228) -Fix/Change (r16187): If we are heading for a different depot, do also not do the refitting-part of the depot-order.
-Fix (r16198): && != &, GetDepotOrderType != GetDepotActionType and - uhm - ODATFB_NEAREST_DEPOT is not set for current_order either.
-rw-r--r--src/vehicle.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/vehicle.cpp b/src/vehicle.cpp
index b2769516e..d3b8020ba 100644
--- a/src/vehicle.cpp
+++ b/src/vehicle.cpp
@@ -1038,9 +1038,19 @@ void VehicleEnterDepot(Vehicle *v)
if (v->current_order.IsType(OT_GOTO_DEPOT)) {
InvalidateWindow(WC_VEHICLE_VIEW, v->index);
+ const Order *real_order = GetVehicleOrder(v, v->cur_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) &&
+ real_order != NULL && !(real_order->GetDepotActionType() & ODATFB_NEAREST_DEPOT) &&
+ (v->type == VEH_AIRCRAFT ? t.GetDestination() != GetStationIndex(v->tile) : v->dest_tile != v->tile)) {
+ /* We are heading for another depot, keep driving. */
+ return;
+ }
+
if (t.IsRefit()) {
_current_company = v->owner;
CommandCost cost = DoCommand(v->tile, v->index, t.GetRefitCargo() | t.GetRefitSubtype() << 8, DC_EXEC, GetCmdRefitVeh(v));
@@ -1057,9 +1067,7 @@ void VehicleEnterDepot(Vehicle *v)
}
}
- if (t.GetDepotOrderType() & ODTFB_PART_OF_ORDERS && (
- (t.GetDepotOrderType() && ODATFB_NEAREST_DEPOT) || // The target depot is only updated on junctions, but we want to accept every depot.
- (v->type == VEH_AIRCRAFT ? t.GetDestination() == GetStationIndex(v->tile) : v->dest_tile == v->tile))) {
+ if (t.GetDepotOrderType() & ODTFB_PART_OF_ORDERS) {
/* Part of orders */
UpdateVehicleTimetable(v, true);
v->cur_order_index++;