File diff r8918:6c77caed2149 → r8919:cac9f783953d
src/roadveh_cmd.cpp
Show inline comments
 
@@ -1705,24 +1705,23 @@ again:
 
	 * and it's the correct type of stop (bus or truck) and the frame equals the stop frame...
 
	 * (the station test and stop type test ensure that other vehicles, using the road stop as
 
	 * a through route, do not stop) */
 
	if (IsRoadVehFront(v) && ((IsInsideMM(v->u.road.state, RVSB_IN_ROAD_STOP, RVSB_IN_ROAD_STOP_END) &&
 
			_road_veh_data_1[v->u.road.state - RVSB_IN_ROAD_STOP + (_opt.road_side << RVS_DRIVE_SIDE)] == v->u.road.frame) ||
 
			(IsInsideMM(v->u.road.state, RVSB_IN_DT_ROAD_STOP, RVSB_IN_DT_ROAD_STOP_END) &&
 
			v->current_order.GetDestination() == GetStationIndex(v->tile) &&
 
			v->current_order.ShouldStopAtStation(v, GetStationIndex(v->tile)) &&
 
			GetRoadStopType(v->tile) == (IsCargoInClass(v->cargo_type, CC_PASSENGERS) ? ROADSTOP_BUS : ROADSTOP_TRUCK) &&
 
			v->u.road.frame == RVC_DRIVE_THROUGH_STOP_FRAME))) {
 

	
 
		RoadStop *rs = GetRoadStopByTile(v->tile, GetRoadStopType(v->tile));
 
		Station* st = GetStationByTile(v->tile);
 

	
 
		/* Vehicle is at the stop position (at a bay) in a road stop.
 
		 * Note, if vehicle is loading/unloading it has already been handled,
 
		 * so if we get here the vehicle has just arrived or is just ready to leave. */
 
		if (!v->current_order.IsType(OT_LEAVESTATION) &&
 
				!v->current_order.IsType(OT_GOTO_DEPOT)) {
 
		if (!v->current_order.IsType(OT_LEAVESTATION)) {
 
			/* Vehicle has arrived at a bay in a road stop */
 

	
 
			if (IsDriveThroughStopTile(v->tile)) {
 
				TileIndex next_tile = TILE_ADD(v->tile, TileOffsByDir(v->direction));
 
				RoadStopType type = IsCargoInClass(v->cargo_type, CC_PASSENGERS) ? ROADSTOP_BUS : ROADSTOP_TRUCK;
 

	
 
@@ -1744,16 +1743,21 @@ again:
 
					}
 
				}
 
			}
 

	
 
			rs->SetEntranceBusy(false);
 

	
 
			v->last_station_visited = GetStationIndex(v->tile);
 
			v->last_station_visited = st->index;
 

	
 
			RoadVehArrivesAt(v, st);
 
			v->BeginLoading();
 
			if (IsDriveThroughStopTile(v->tile) || v->current_order.GetDestination() == st->index) {
 
				RoadVehArrivesAt(v, st);
 
				v->BeginLoading();
 
			} else {
 
				v->current_order.MakeLeaveStation();
 
				InvalidateVehicleOrder(v);
 
			}
 

	
 
			return false;
 
		}
 

	
 
		/* Vehicle is ready to leave a bay in a road stop */
 
		if (!v->current_order.IsType(OT_GOTO_DEPOT)) {
 
@@ -1803,12 +1807,14 @@ again:
 
	r = VehicleEnterTile(v, v->tile, x, y);
 
	if (HasBit(r, VETS_CANNOT_ENTER)) {
 
		v->cur_speed = 0;
 
		return false;
 
	}
 

	
 
	if (v->current_order.IsType(OT_LEAVESTATION) && IsDriveThroughStopTile(v->tile)) v->current_order.Free();
 

	
 
	/* Move to next frame unless vehicle arrived at a stop position
 
	 * in a depot or entered a tunnel/bridge */
 
	if (!HasBit(r, VETS_ENTERED_WORMHOLE)) v->u.road.frame++;
 

	
 
	v->cur_image = v->GetImage(v->direction);
 
	v->UpdateDeltaXY(v->direction);