|
@@ -1428,49 +1428,49 @@ again:
|
|
|
|
|
|
/* If the vehicle is in a normal road stop and the frame equals the stop frame OR
|
|
|
* if the vehicle is in a drive-through road stop and this is the destination station
|
|
|
* 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 (v->IsFrontEngine() && ((IsInsideMM(v->state, RVSB_IN_ROAD_STOP, RVSB_IN_ROAD_STOP_END) &&
|
|
|
_road_stop_stop_frame[v->state - RVSB_IN_ROAD_STOP + (_settings_game.vehicle.road_side << RVS_DRIVE_SIDE)] == v->frame) ||
|
|
|
(IsInsideMM(v->state, RVSB_IN_DT_ROAD_STOP, RVSB_IN_DT_ROAD_STOP_END) &&
|
|
|
v->current_order.ShouldStopAtStation(v, GetStationIndex(v->tile)) &&
|
|
|
v->owner == GetTileOwner(v->tile) &&
|
|
|
GetRoadStopType(v->tile) == (v->IsBus() ? ROADSTOP_BUS : ROADSTOP_TRUCK) &&
|
|
|
v->frame == RVC_DRIVE_THROUGH_STOP_FRAME))) {
|
|
|
|
|
|
RoadStop *rs = RoadStop::GetByTile(v->tile, GetRoadStopType(v->tile));
|
|
|
Station *st = Station::GetByTile(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 (!HasBit(v->state, RVS_ENTERED_STOP)) {
|
|
|
/* Vehicle has arrived at a bay in a road stop */
|
|
|
|
|
|
if (IsDriveThroughStopTile(v->tile)) {
|
|
|
TileIndex next_tile = TILE_ADD(v->tile, TileOffsByDir(v->direction));
|
|
|
TileIndex next_tile = TileAddByDir(v->tile, v->direction);
|
|
|
|
|
|
/* Check if next inline bay is free and has compatible road. */
|
|
|
if (RoadStop::IsDriveThroughRoadStopContinuation(v->tile, next_tile) && (GetRoadTypes(next_tile) & v->compatible_roadtypes) != 0) {
|
|
|
v->frame++;
|
|
|
v->x_pos = x;
|
|
|
v->y_pos = y;
|
|
|
v->UpdatePosition();
|
|
|
RoadZPosAffectSpeed(v, v->UpdateInclination(true, false));
|
|
|
return true;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
rs->SetEntranceBusy(false);
|
|
|
SetBit(v->state, RVS_ENTERED_STOP);
|
|
|
|
|
|
v->last_station_visited = st->index;
|
|
|
|
|
|
if (IsDriveThroughStopTile(v->tile) || (v->current_order.IsType(OT_GOTO_STATION) && v->current_order.GetDestination() == st->index)) {
|
|
|
RoadVehArrivesAt(v, st);
|
|
|
v->BeginLoading();
|
|
|
return false;
|
|
|
}
|
|
|
} else {
|
|
|
/* Vehicle is ready to leave a bay in a road stop */
|