summaryrefslogtreecommitdiff
path: root/src/roadveh_cmd.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-04-13 16:54:19 +0000
committerrubidium <rubidium@openttd.org>2008-04-13 16:54:19 +0000
commite8ee93b5938642bb25e0a5e349d9ce4c7c071960 (patch)
treec86cfde879096a6a1bcd92d313e174e9a965cc68 /src/roadveh_cmd.cpp
parent145ea544749580b0390b4b69b6e3772995d51502 (diff)
downloadopenttd-e8ee93b5938642bb25e0a5e349d9ce4c7c071960.tar.xz
(svn r12689) -Feature: non-stop(or rather no non-stop) and via orders for road vehicles.
Diffstat (limited to 'src/roadveh_cmd.cpp')
-rw-r--r--src/roadveh_cmd.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/roadveh_cmd.cpp b/src/roadveh_cmd.cpp
index 2946753cd..2144c49a4 100644
--- a/src/roadveh_cmd.cpp
+++ b/src/roadveh_cmd.cpp
@@ -1708,7 +1708,7 @@ again:
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))) {
@@ -1718,8 +1718,7 @@ again:
/* 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)) {
@@ -1747,10 +1746,15 @@ 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;
}
@@ -1806,6 +1810,8 @@ again:
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++;