# HG changeset patch # User rubidium # Date 2008-06-19 11:45:52 # Node ID e67d1ef57a67e953ebf589bd5e597375ea195677 # Parent 26af114e8a808c4c10c65d1f765c5afb95c1675b (svn r13579) -Fix [FS#2088]: process the order coming after a conditional order, otherwise the vehicle would already leaving the station before it knows where the next destination is, making it leave in the wrong way. However, after processing as many conditional orders as there are in the order list it will stop processing them in order to not create an infinite loop. diff --git a/src/order_cmd.cpp b/src/order_cmd.cpp --- a/src/order_cmd.cpp +++ b/src/order_cmd.cpp @@ -1644,7 +1644,7 @@ static VehicleOrderID ProcessConditional * @param order the order the vehicle currently has * @param v the vehicle to update */ -static bool UpdateOrderDest(Vehicle *v, const Order *order) +static bool UpdateOrderDest(Vehicle *v, const Order *order, int conditional_depth = 0) { switch (order->GetType()) { case OT_GOTO_STATION: @@ -1691,7 +1691,13 @@ static bool UpdateOrderDest(Vehicle *v, } else { v->cur_order_index++; } - return false; + + 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); } default: