src/roadveh_cmd.cpp
changeset 6127 a256e61e86f9
parent 6102 5e72b97b987a
child 6161 754debc55207
equal deleted inserted replaced
6126:40a18030c3aa 6127:a256e61e86f9
   688 
   688 
   689 			if (order->dest == v->last_station_visited) {
   689 			if (order->dest == v->last_station_visited) {
   690 				v->last_station_visited = INVALID_STATION;
   690 				v->last_station_visited = INVALID_STATION;
   691 			}
   691 			}
   692 
   692 
   693 			rs = GetPrimaryRoadStop(
   693 			rs = GetStation(order->dest)->GetPrimaryRoadStop(
   694 				GetStation(order->dest),
       
   695 				v->cargo_type == CT_PASSENGERS ? RoadStop::BUS : RoadStop::TRUCK
   694 				v->cargo_type == CT_PASSENGERS ? RoadStop::BUS : RoadStop::TRUCK
   696 			);
   695 			);
   697 
   696 
   698 			if (rs != NULL) {
   697 			if (rs != NULL) {
   699 				TileIndex dest = rs->xy;
   698 				TileIndex dest = rs->xy;
  1658 	if (v->vehstatus & VS_STOPPED) return;
  1657 	if (v->vehstatus & VS_STOPPED) return;
  1659 
  1658 
  1660 	/* update destination */
  1659 	/* update destination */
  1661 	if (v->current_order.type == OT_GOTO_STATION && v->u.road.slot == NULL && !(v->vehstatus & VS_CRASHED)) {
  1660 	if (v->current_order.type == OT_GOTO_STATION && v->u.road.slot == NULL && !(v->vehstatus & VS_CRASHED)) {
  1662 		Station* st = GetStation(v->current_order.dest);
  1661 		Station* st = GetStation(v->current_order.dest);
  1663 		RoadStop* rs = GetPrimaryRoadStop(st, v->cargo_type == CT_PASSENGERS ? RoadStop::BUS : RoadStop::TRUCK);
  1662 		RoadStop* rs = st->GetPrimaryRoadStop(v->cargo_type == CT_PASSENGERS ? RoadStop::BUS : RoadStop::TRUCK);
  1664 		RoadStop* best = NULL;
  1663 		RoadStop* best = NULL;
  1665 
  1664 
  1666 		if (rs != NULL) {
  1665 		if (rs != NULL) {
  1667 			if (DistanceManhattan(v->tile, st->xy) < 16) {
  1666 			if (DistanceManhattan(v->tile, st->xy) < 16) {
  1668 				uint dist, badness;
  1667 				uint dist, badness;