src/train_cmd.cpp
changeset 10307 86ce4ec269d4
parent 10287 e84ee4b8ba7b
child 10314 ac0958307f68
equal deleted inserted replaced
10306:38e0bf4a820e 10307:86ce4ec269d4
  2924 
  2924 
  2925 	/* Save the current train order. The destructor will restore the old order on function exit. */
  2925 	/* Save the current train order. The destructor will restore the old order on function exit. */
  2926 	VehicleOrderSaver orders(v);
  2926 	VehicleOrderSaver orders(v);
  2927 
  2927 
  2928 	/* If the current tile is the destination of the current order and
  2928 	/* If the current tile is the destination of the current order and
  2929 	* a reservation was requested, advance to the next order. */
  2929 	 * a reservation was requested, advance to the next order.
  2930 	if (v->tile == v->dest_tile || (v->current_order.IsType(OT_GOTO_STATION) && IsRailwayStationTile(v->tile) && v->current_order.GetDestination() == GetStationIndex(v->tile))) {
  2930 	 * Don't advance on a depot order as depots are always safe end points
       
  2931 	 * for a path and no look-ahead is necessary. This also avoids a
       
  2932 	 * problem with depot orders not part of the order list when the
       
  2933 	 * order list itself is empty. */
       
  2934 	if (!v->current_order.IsType(OT_GOTO_DEPOT) && (v->tile == v->dest_tile || (v->current_order.IsType(OT_GOTO_STATION) && IsRailwayStationTile(v->tile) && v->current_order.GetDestination() == GetStationIndex(v->tile)))) {
  2931 		orders.SwitchToNextOrder();
  2935 		orders.SwitchToNextOrder();
  2932 	}
  2936 	}
  2933 
  2937 
  2934 	if (res_dest.tile != INVALID_TILE && !res_dest.okay) {
  2938 	if (res_dest.tile != INVALID_TILE && !res_dest.okay) {
  2935 		/* Pathfinders are able to tell that route was only 'guessed'. */
  2939 		/* Pathfinders are able to tell that route was only 'guessed'. */