summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2008-08-23 00:32:01 +0000
committerfrosch <frosch@openttd.org>2008-08-23 00:32:01 +0000
commitf625ecbeba53c4d25cd2ad2755924448522af8e9 (patch)
tree10c6462fe3925aa310917b976773a9dfa2482898 /src
parentca27155a52b5e08644f2d5b2d13a4f4877236ebe (diff)
downloadopenttd-f625ecbeba53c4d25cd2ad2755924448522af8e9.tar.xz
(svn r14134) -Fix (r12667, r13579) [FS#2245]: Update 'current_order' when changing 'cur_order_index'.
Diffstat (limited to 'src')
-rw-r--r--src/order_cmd.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/order_cmd.cpp b/src/order_cmd.cpp
index 37ade0deb..b71fbc8c1 100644
--- a/src/order_cmd.cpp
+++ b/src/order_cmd.cpp
@@ -1628,6 +1628,8 @@ bool UpdateOrderDest(Vehicle *v, const Order *order, int conditional_depth)
break;
case OT_CONDITIONAL: {
+ if (conditional_depth > v->num_orders) return false;
+
VehicleOrderID next_order = ProcessConditionalOrder(order, v);
if (next_order != INVALID_VEH_ORDER_ID) {
UpdateVehicleTimetable(v, false);
@@ -1638,12 +1640,12 @@ bool UpdateOrderDest(Vehicle *v, const Order *order, int conditional_depth)
v->cur_order_index++;
}
- if (conditional_depth > v->num_orders) return false;
-
/* Get the current order */
if (v->cur_order_index >= v->num_orders) v->cur_order_index = 0;
- return UpdateOrderDest(v, GetVehicleOrder(v, v->cur_order_index), conditional_depth + 1);
+ const Order *order = GetVehicleOrder(v, v->cur_order_index);
+ v->current_order = *order;
+ return UpdateOrderDest(v, order, conditional_depth + 1);
}
default: