train_cmd.c
changeset 3005 2590b9b4823b
parent 2999 1d613b0e6884
child 3007 5c0d90264d47
equal deleted inserted replaced
3004:cac6aff8cc52 3005:2590b9b4823b
  2272 static bool ProcessTrainOrder(Vehicle *v)
  2272 static bool ProcessTrainOrder(Vehicle *v)
  2273 {
  2273 {
  2274 	const Order *order;
  2274 	const Order *order;
  2275 	bool result;
  2275 	bool result;
  2276 
  2276 
  2277 	// These are un-interruptible
  2277 	switch (v->current_order.type) {
  2278 	if (v->current_order.type >= OT_GOTO_DEPOT &&
  2278 		case OT_GOTO_DEPOT:
  2279 			v->current_order.type <= OT_LEAVESTATION) {
  2279 			if (!(v->current_order.flags & OF_PART_OF_ORDERS)) return false;
  2280 		// Let a depot order in the orderlist interrupt.
  2280 			if ((v->current_order.flags & OF_SERVICE_IF_NEEDED) &&
  2281 		if (v->current_order.type != OT_GOTO_DEPOT ||
  2281 					!VehicleNeedsService(v)) {
  2282 				!(v->current_order.flags & OF_UNLOAD))
  2282 				v->cur_order_index++;
       
  2283 			}
       
  2284 			break;
       
  2285 
       
  2286 		case OT_LOADING:
       
  2287 		case OT_LEAVESTATION:
  2283 			return false;
  2288 			return false;
  2284 	}
       
  2285 
       
  2286 	if (v->current_order.type == OT_GOTO_DEPOT &&
       
  2287 			(v->current_order.flags & (OF_PART_OF_ORDERS | OF_SERVICE_IF_NEEDED)) ==  (OF_PART_OF_ORDERS | OF_SERVICE_IF_NEEDED) &&
       
  2288 			!VehicleNeedsService(v)) {
       
  2289 		v->cur_order_index++;
       
  2290 	}
  2289 	}
  2291 
  2290 
  2292 	// check if we've reached the waypoint?
  2291 	// check if we've reached the waypoint?
  2293 	if (v->current_order.type == OT_GOTO_WAYPOINT && v->tile == v->dest_tile) {
  2292 	if (v->current_order.type == OT_GOTO_WAYPOINT && v->tile == v->dest_tile) {
  2294 		v->cur_order_index++;
  2293 		v->cur_order_index++;