summaryrefslogtreecommitdiff
path: root/ship_cmd.c
diff options
context:
space:
mode:
authortron <tron@openttd.org>2006-02-10 06:33:56 +0000
committertron <tron@openttd.org>2006-02-10 06:33:56 +0000
commitf5b564bc44a449b839669d63dda59e3941383fbe (patch)
tree5c52e064b06b38d8991161e44f238635f6204f69 /ship_cmd.c
parent784801f930cb83f5829209bf8651645ed7c1d814 (diff)
downloadopenttd-f5b564bc44a449b839669d63dda59e3941383fbe.tar.xz
(svn r3585) Similar changes to the order handlers of the other vehicle types like r3584
Diffstat (limited to 'ship_cmd.c')
-rw-r--r--ship_cmd.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/ship_cmd.c b/ship_cmd.c
index 3a80aca09..651239286 100644
--- a/ship_cmd.c
+++ b/ship_cmd.c
@@ -203,22 +203,21 @@ static void ProcessShipOrder(Vehicle *v)
{
const Order *order;
- if (v->current_order.type >= OT_GOTO_DEPOT &&
- v->current_order.type <= OT_LEAVESTATION) {
- if (v->current_order.type != OT_GOTO_DEPOT ||
- !(v->current_order.flags & OF_UNLOAD))
- return;
- }
+ switch (v->current_order.type) {
+ case OT_GOTO_DEPOT:
+ if (!(v->current_order.flags & OF_PART_OF_ORDERS)) return;
+ if (v->current_order.flags & OF_SERVICE_IF_NEEDED &&
+ !VehicleNeedsService(v)) {
+ v->cur_order_index++;
+ }
+ break;
- if (v->current_order.type == OT_GOTO_DEPOT &&
- (v->current_order.flags & (OF_PART_OF_ORDERS | OF_SERVICE_IF_NEEDED)) == (OF_PART_OF_ORDERS | OF_SERVICE_IF_NEEDED) &&
- !VehicleNeedsService(v)) {
- v->cur_order_index++;
+ case OT_LOADING:
+ case OT_LEAVESTATION:
+ return;
}
-
- if (v->cur_order_index >= v->num_orders)
- v->cur_order_index = 0;
+ if (v->cur_order_index >= v->num_orders) v->cur_order_index = 0;
order = GetVehicleOrder(v, v->cur_order_index);