summaryrefslogtreecommitdiff
path: root/src/order_cmd.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-10-24 14:49:45 +0000
committerrubidium <rubidium@openttd.org>2008-10-24 14:49:45 +0000
commit42df5cbc03042b75cab04b634a1c53b3dd87d507 (patch)
tree40582103b55598cf5fc668c1f58b05dee89d131d /src/order_cmd.cpp
parente0940888523e2a48760e5c528300be5ef983960d (diff)
downloadopenttd-42df5cbc03042b75cab04b634a1c53b3dd87d507.tar.xz
(svn r14524) -Add: stop-in-depot as part of orders (PhilSophus)
Diffstat (limited to 'src/order_cmd.cpp')
-rw-r--r--src/order_cmd.cpp26
1 files changed, 22 insertions, 4 deletions
diff --git a/src/order_cmd.cpp b/src/order_cmd.cpp
index cca67c8fd..6e67d7e83 100644
--- a/src/order_cmd.cpp
+++ b/src/order_cmd.cpp
@@ -906,7 +906,7 @@ CommandCost CmdModifyOrder(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
break;
case MOF_DEPOT_ACTION:
- if (data != 0) return CMD_ERROR;
+ if (data >= DA_END) return CMD_ERROR;
break;
case MOF_COND_VARIABLE:
@@ -969,9 +969,27 @@ CommandCost CmdModifyOrder(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
}
break;
- case MOF_DEPOT_ACTION:
- order->SetDepotOrderType((OrderDepotTypeFlags)(order->GetDepotOrderType() ^ ODTFB_SERVICE));
- break;
+ case MOF_DEPOT_ACTION: {
+ switch (data) {
+ case DA_ALWAYS_GO:
+ order->SetDepotOrderType((OrderDepotTypeFlags)(order->GetDepotOrderType() & ~ODTFB_SERVICE));
+ order->SetDepotActionType((OrderDepotActionFlags)(order->GetDepotActionType() & ~ODATFB_HALT));
+ break;
+
+ case DA_SERVICE:
+ order->SetDepotOrderType((OrderDepotTypeFlags)(order->GetDepotOrderType() | ODTFB_SERVICE));
+ order->SetDepotActionType((OrderDepotActionFlags)(order->GetDepotActionType() & ~ODATFB_HALT));
+ break;
+
+ case DA_STOP:
+ order->SetDepotOrderType((OrderDepotTypeFlags)(order->GetDepotOrderType() & ~ODTFB_SERVICE));
+ order->SetDepotActionType((OrderDepotActionFlags)(order->GetDepotActionType() | ODATFB_HALT));
+ break;
+
+ default:
+ NOT_REACHED();
+ }
+ } break;
case MOF_COND_VARIABLE: {
order->SetConditionVariable((OrderConditionVariable)data);