src/roadveh_cmd.cpp
changeset 11106 f51503265cb2
parent 11090 3ac220ac9a47
child 11133 a75c67ae67b0
equal deleted inserted replaced
11105:bbcfdef0958e 11106:f51503265cb2
  1717 			v->owner == GetRoadOwner(v->tile, v->u.road.roadtype) &&
  1717 			v->owner == GetRoadOwner(v->tile, v->u.road.roadtype) &&
  1718 			GetRoadStopType(v->tile) == (IsCargoInClass(v->cargo_type, CC_PASSENGERS) ? ROADSTOP_BUS : ROADSTOP_TRUCK) &&
  1718 			GetRoadStopType(v->tile) == (IsCargoInClass(v->cargo_type, CC_PASSENGERS) ? ROADSTOP_BUS : ROADSTOP_TRUCK) &&
  1719 			v->u.road.frame == RVC_DRIVE_THROUGH_STOP_FRAME))) {
  1719 			v->u.road.frame == RVC_DRIVE_THROUGH_STOP_FRAME))) {
  1720 
  1720 
  1721 		RoadStop *rs = GetRoadStopByTile(v->tile, GetRoadStopType(v->tile));
  1721 		RoadStop *rs = GetRoadStopByTile(v->tile, GetRoadStopType(v->tile));
  1722 		Station* st = GetStationByTile(v->tile);
  1722 		Station *st = GetStationByTile(v->tile);
  1723 
  1723 
  1724 		/* Vehicle is at the stop position (at a bay) in a road stop.
  1724 		/* Vehicle is at the stop position (at a bay) in a road stop.
  1725 		 * Note, if vehicle is loading/unloading it has already been handled,
  1725 		 * Note, if vehicle is loading/unloading it has already been handled,
  1726 		 * so if we get here the vehicle has just arrived or is just ready to leave. */
  1726 		 * so if we get here the vehicle has just arrived or is just ready to leave. */
  1727 		if (!v->current_order.IsType(OT_LEAVESTATION)) {
  1727 		if (!v->current_order.IsType(OT_LEAVESTATION)) {
  1752 
  1752 
  1753 			rs->SetEntranceBusy(false);
  1753 			rs->SetEntranceBusy(false);
  1754 
  1754 
  1755 			v->last_station_visited = st->index;
  1755 			v->last_station_visited = st->index;
  1756 
  1756 
  1757 			if (IsDriveThroughStopTile(v->tile) || v->current_order.GetDestination() == st->index) {
  1757 			if (IsDriveThroughStopTile(v->tile) || (v->current_order.IsType(OT_GOTO_STATION) && v->current_order.GetDestination() == st->index)) {
  1758 				RoadVehArrivesAt(v, st);
  1758 				RoadVehArrivesAt(v, st);
  1759 				v->BeginLoading();
  1759 				v->BeginLoading();
  1760 			} else {
  1760 				return false;
  1761 				v->current_order.MakeLeaveStation();
  1761 			}
  1762 				InvalidateVehicleOrder(v);
  1762 		} else {
  1763 			}
  1763 			/* Vehicle is ready to leave a bay in a road stop */
  1764 
       
  1765 			return false;
       
  1766 		}
       
  1767 
       
  1768 		/* Vehicle is ready to leave a bay in a road stop */
       
  1769 		if (!v->current_order.IsType(OT_GOTO_DEPOT)) {
       
  1770 			if (rs->IsEntranceBusy()) {
  1764 			if (rs->IsEntranceBusy()) {
  1771 				/* Road stop entrance is busy, so wait as there is nowhere else to go */
  1765 				/* Road stop entrance is busy, so wait as there is nowhere else to go */
  1772 				v->cur_speed = 0;
  1766 				v->cur_speed = 0;
  1773 				return false;
  1767 				return false;
  1774 			}
  1768 			}