Changeset - r10327:7253b31623a8
[Not reviewed]
master
0 1 0
smatz - 16 years ago 2008-11-11 22:51:27
smatz@openttd.org
(svn r14577) -Fix [FS#2403]: vehicle didn't respect its 'refit in nearest depot' order (Swallow)
1 file changed with 1 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/order_cmd.cpp
Show inline comments
 
@@ -1602,49 +1602,49 @@ VehicleOrderID ProcessConditionalOrder(c
 
	return skip_order ? order->GetConditionSkipToOrder() : (VehicleOrderID)INVALID_VEH_ORDER_ID;
 
}
 

	
 
/**
 
 * Update the vehicle's destination tile from an order.
 
 * @param order the order the vehicle currently has
 
 * @param v the vehicle to update
 
 */
 
bool UpdateOrderDest(Vehicle *v, const Order *order, int conditional_depth)
 
{
 
	switch (order->GetType()) {
 
		case OT_GOTO_STATION:
 
			v->dest_tile = v->GetOrderStationLocation(order->GetDestination());
 
			break;
 

	
 
		case OT_GOTO_DEPOT:
 
			if (v->current_order.GetDepotActionType() & ODATFB_NEAREST_DEPOT) {
 
				/* We need to search for the nearest depot (hangar). */
 
				TileIndex location;
 
				DestinationID destination;
 
				bool reverse;
 

	
 
				if (v->FindClosestDepot(&location, &destination, &reverse)) {
 
					v->dest_tile = location;
 
					v->current_order.MakeGoToDepot(destination, v->current_order.GetDepotOrderType());
 
					v->current_order.MakeGoToDepot(destination, v->current_order.GetDepotOrderType(), v->current_order.GetRefitCargo(), v->current_order.GetRefitSubtype());
 

	
 
					/* If there is no depot in front, reverse automatically (trains only) */
 
					if (v->type == VEH_TRAIN && reverse) DoCommand(v->tile, v->index, 0, DC_EXEC, CMD_REVERSE_TRAIN_DIRECTION);
 

	
 
					if (v->type == VEH_AIRCRAFT && v->u.air.state == FLYING && v->u.air.targetairport != destination) {
 
						/* The aircraft is now heading for a different hangar than the next in the orders */
 
						extern void AircraftNextAirportPos_and_Order(Vehicle *v);
 
						AircraftNextAirportPos_and_Order(v);
 
					}
 
				} else {
 
					UpdateVehicleTimetable(v, true);
 
					v->cur_order_index++;
 
				}
 
			} else if (v->type != VEH_AIRCRAFT) {
 
				v->dest_tile = GetDepot(order->GetDestination())->xy;
 
			}
 
			break;
 

	
 
		case OT_GOTO_WAYPOINT:
 
			v->dest_tile = GetWaypoint(order->GetDestination())->xy;
 
			break;
 

	
 
		case OT_CONDITIONAL: {
 
			if (conditional_depth > v->num_orders) return false;
0 comments (0 inline, 0 general)