equal
deleted
inserted
replaced
1642 /** |
1642 /** |
1643 * Update the vehicle's destination tile from an order. |
1643 * Update the vehicle's destination tile from an order. |
1644 * @param order the order the vehicle currently has |
1644 * @param order the order the vehicle currently has |
1645 * @param v the vehicle to update |
1645 * @param v the vehicle to update |
1646 */ |
1646 */ |
1647 static bool UpdateOrderDest(Vehicle *v, const Order *order) |
1647 static bool UpdateOrderDest(Vehicle *v, const Order *order, int conditional_depth = 0) |
1648 { |
1648 { |
1649 switch (order->GetType()) { |
1649 switch (order->GetType()) { |
1650 case OT_GOTO_STATION: |
1650 case OT_GOTO_STATION: |
1651 v->dest_tile = v->GetOrderStationLocation(order->GetDestination()); |
1651 v->dest_tile = v->GetOrderStationLocation(order->GetDestination()); |
1652 break; |
1652 break; |
1689 if (next_order != INVALID_VEH_ORDER_ID) { |
1689 if (next_order != INVALID_VEH_ORDER_ID) { |
1690 v->cur_order_index = next_order; |
1690 v->cur_order_index = next_order; |
1691 } else { |
1691 } else { |
1692 v->cur_order_index++; |
1692 v->cur_order_index++; |
1693 } |
1693 } |
1694 return false; |
1694 |
|
1695 if (conditional_depth > v->num_orders) return false; |
|
1696 |
|
1697 /* Get the current order */ |
|
1698 if (v->cur_order_index >= v->num_orders) v->cur_order_index = 0; |
|
1699 |
|
1700 return UpdateOrderDest(v, GetVehicleOrder(v, v->cur_order_index), conditional_depth + 1); |
1695 } |
1701 } |
1696 |
1702 |
1697 default: |
1703 default: |
1698 v->dest_tile = 0; |
1704 v->dest_tile = 0; |
1699 return false; |
1705 return false; |