summaryrefslogtreecommitdiff
path: root/src/order_cmd.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2011-07-02 16:45:54 +0000
committerfrosch <frosch@openttd.org>2011-07-02 16:45:54 +0000
commit55a21a940d81b57b6c889a2839cb592690da404c (patch)
tree183bd9353e8cd51d8b99cc42e733941a22f4eb48 /src/order_cmd.cpp
parent1bc1a42ea57c038df25f2e538bea77fa5451c30d (diff)
downloadopenttd-55a21a940d81b57b6c889a2839cb592690da404c.tar.xz
(svn r22620) -Change [FS#4651]: Enforce refit orders to be 'always go to depot' orders; service-only and stop-in-depot orders make no sense with refitting.
Diffstat (limited to 'src/order_cmd.cpp')
-rw-r--r--src/order_cmd.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/order_cmd.cpp b/src/order_cmd.cpp
index dee910a8a..e8d1899fc 100644
--- a/src/order_cmd.cpp
+++ b/src/order_cmd.cpp
@@ -1280,11 +1280,13 @@ CommandCost CmdModifyOrder(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
case DA_SERVICE:
order->SetDepotOrderType((OrderDepotTypeFlags)(order->GetDepotOrderType() | ODTFB_SERVICE));
order->SetDepotActionType((OrderDepotActionFlags)(order->GetDepotActionType() & ~ODATFB_HALT));
+ order->SetRefit(CT_NO_REFIT);
break;
case DA_STOP:
order->SetDepotOrderType((OrderDepotTypeFlags)(order->GetDepotOrderType() & ~ODTFB_SERVICE));
order->SetDepotActionType((OrderDepotActionFlags)(order->GetDepotActionType() | ODATFB_HALT));
+ order->SetRefit(CT_NO_REFIT);
break;
default:
@@ -1529,6 +1531,12 @@ CommandCost CmdOrderRefit(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
if (flags & DC_EXEC) {
order->SetRefit(cargo, subtype);
+ /* Make the depot order an 'always go' order. */
+ if (cargo != CT_NO_REFIT) {
+ order->SetDepotOrderType((OrderDepotTypeFlags)(order->GetDepotOrderType() & ~ODTFB_SERVICE));
+ order->SetDepotActionType((OrderDepotActionFlags)(order->GetDepotActionType() & ~ODATFB_HALT));
+ }
+
for (Vehicle *u = v->FirstShared(); u != NULL; u = u->NextShared()) {
/* Update any possible open window of the vehicle */
InvalidateVehicleOrder(u, -2);