order_cmd.c
changeset 1297 9b867da8f798
parent 1266 eccd576e322f
child 1314 10c3417e9c22
equal deleted inserted replaced
1296:3c9e4c7fea2d 1297:9b867da8f798
   483 				return CMD_ERROR;
   483 				return CMD_ERROR;
   484 
   484 
   485 			/* Trucks can't copy all the orders from busses (and visa versa) */
   485 			/* Trucks can't copy all the orders from busses (and visa versa) */
   486 			if (src->type == VEH_Road) {
   486 			if (src->type == VEH_Road) {
   487 				const Order *order;
   487 				const Order *order;
   488 				TileIndex required_dst;
   488 				TileIndex required_dst = INVALID_TILE;
   489 
   489 
   490 				FOR_VEHICLE_ORDERS(src, order) {
   490 				FOR_VEHICLE_ORDERS(src, order) {
   491 					if (order->type == OT_GOTO_STATION) {
   491 					if (order->type == OT_GOTO_STATION) {
   492 						const Station *st = GetStation(order->station);
   492 						const Station *st = GetStation(order->station);
   493 						required_dst = (dst->cargo_type == CT_PASSENGERS) ? st->bus_stops->xy : st->truck_stops->xy;
   493 						if (dst->cargo_type == CT_PASSENGERS) {
       
   494 							if (st->bus_stops != NULL) required_dst = st->bus_stops->xy;
       
   495 						} else {
       
   496 							if (st->truck_stops != NULL) required_dst = st->truck_stops->xy;
       
   497 						}
   494 						/* This station has not the correct road-bay, so we can't copy! */
   498 						/* This station has not the correct road-bay, so we can't copy! */
   495 						if (!required_dst)
   499 						if (required_dst == INVALID_TILE)
   496 							return CMD_ERROR;
   500 							return CMD_ERROR;
   497 					}
   501 					}
   498 				}
   502 				}
   499 			}
   503 			}
   500 
   504