summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/openttd.cpp7
-rw-r--r--src/order_cmd.cpp5
-rw-r--r--src/order_gui.cpp9
-rw-r--r--src/roadveh_cmd.cpp18
-rw-r--r--src/station_cmd.cpp4
5 files changed, 29 insertions, 14 deletions
diff --git a/src/openttd.cpp b/src/openttd.cpp
index 25798c486..13edd2423 100644
--- a/src/openttd.cpp
+++ b/src/openttd.cpp
@@ -2451,7 +2451,12 @@ bool AfterLoadGame()
FOR_ALL_ORDERS(order) order->ConvertFromOldSavegame();
Vehicle *v;
- FOR_ALL_VEHICLES(v) v->current_order.ConvertFromOldSavegame();
+ FOR_ALL_VEHICLES(v) {
+ v->current_order.ConvertFromOldSavegame();
+ if (v->type == VEH_ROAD && v->IsPrimaryVehicle() && v->prev_shared == NULL) {
+ FOR_VEHICLE_ORDERS(v, order) order->SetNonStopType(ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS);
+ }
+ }
} else if (CheckSavegameVersion(94)) {
/* Unload and transfer are now mutual exclusive. */
Order *order;
diff --git a/src/order_cmd.cpp b/src/order_cmd.cpp
index 64e235ce6..1929760c3 100644
--- a/src/order_cmd.cpp
+++ b/src/order_cmd.cpp
@@ -358,7 +358,7 @@ CommandCost CmdInsertOrder(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
}
/* Non stop not allowed for non-trains. */
- if (new_order.GetNonStopType() != ONSF_STOP_EVERYWHERE && v->type != VEH_TRAIN) return CMD_ERROR;
+ if (new_order.GetNonStopType() != ONSF_STOP_EVERYWHERE && v->type != VEH_TRAIN && v->type != VEH_ROAD) return CMD_ERROR;
/* Full load and unload are mutual exclusive. */
if ((new_order.GetLoadType() & OLFB_FULL_LOAD) && (new_order.GetUnloadType() & OUFB_UNLOAD)) return CMD_ERROR;
@@ -412,7 +412,7 @@ CommandCost CmdInsertOrder(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
if (!IsPlayerBuildableVehicleType(v)) return CMD_ERROR;
}
- if (new_order.GetNonStopType() != ONSF_STOP_EVERYWHERE && v->type != VEH_TRAIN) return CMD_ERROR;
+ if (new_order.GetNonStopType() != ONSF_STOP_EVERYWHERE && v->type != VEH_TRAIN && v->type != VEH_ROAD) return CMD_ERROR;
if (new_order.GetDepotOrderType() & ~ODTFB_PART_OF_ORDERS) return CMD_ERROR;
if (new_order.GetDepotActionType() & ~ODATFB_NEAREST_DEPOT) return CMD_ERROR;
break;
@@ -869,6 +869,7 @@ CommandCost CmdModifyOrder(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
default: NOT_REACHED();
case MOF_NON_STOP:
+ if (v->type != VEH_TRAIN && v->type != VEH_ROAD) return CMD_ERROR;
if (data >= ONSF_END) return CMD_ERROR;
if (data == order->GetNonStopType()) return CMD_ERROR;
break;
diff --git a/src/order_gui.cpp b/src/order_gui.cpp
index 02d3e5fcb..56350f5e2 100644
--- a/src/order_gui.cpp
+++ b/src/order_gui.cpp
@@ -237,7 +237,7 @@ static void DrawOrdersWindow(Window *w)
(uint)v->num_orders + ((shared_orders || v->num_orders != 0) ? 1 : 0) <= (uint)WP(w, order_d).sel);
/* non-stop only for trains */
- w->SetWidgetDisabledState(ORDER_WIDGET_NON_STOP, v->type != VEH_TRAIN || order == NULL);
+ w->SetWidgetDisabledState(ORDER_WIDGET_NON_STOP, (v->type != VEH_TRAIN && v->type != VEH_ROAD) || order == NULL);
w->SetWidgetDisabledState(ORDER_WIDGET_FULL_LOAD, order == NULL || (order->GetNonStopType() & ONSF_NO_STOP_AT_DESTINATION_STATION) != 0); // full load
w->SetWidgetDisabledState(ORDER_WIDGET_UNLOAD, order == NULL || (order->GetNonStopType() & ONSF_NO_STOP_AT_DESTINATION_STATION) != 0); // unload
/* Disable list of vehicles with the same shared orders if there is no list */
@@ -325,7 +325,7 @@ static void DrawOrdersWindow(Window *w)
OrderUnloadFlags unload = order->GetUnloadType();
SetDParam(1, STR_GO_TO_STATION);
- SetDParam(2, STR_ORDER_GO_TO + (v->type == VEH_TRAIN ? order->GetNonStopType() : 0));
+ SetDParam(2, STR_ORDER_GO_TO + ((v->type == VEH_TRAIN || v->type == VEH_ROAD) ? order->GetNonStopType() : 0));
SetDParam(3, order->GetDestination());
SetDParam(4, (order->GetNonStopType() & ONSF_NO_STOP_AT_DESTINATION_STATION) ? STR_EMPTY : _station_load_types[unload][load]);
} break;
@@ -431,6 +431,7 @@ static Order GetOrderCmdFromTile(const Vehicle *v, TileIndex tile)
case MP_ROAD:
if (IsRoadDepot(tile) && v->type == VEH_ROAD && IsTileOwner(tile, _local_player)) {
order.MakeGoToDepot(GetDepotByTile(tile)->index, ODTFB_PART_OF_ORDERS);
+ if (_patches.new_nonstop) order.SetNonStopType(ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS);
return order;
}
break;
@@ -481,7 +482,7 @@ static Order GetOrderCmdFromTile(const Vehicle *v, TileIndex tile)
(facil = FACIL_TRUCK_STOP, 1);
if (st->facilities & facil) {
order.MakeGoToStation(st_index);
- if (_patches.new_nonstop && v->type == VEH_TRAIN) order.SetNonStopType(ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS);
+ if (_patches.new_nonstop && (v->type == VEH_TRAIN || v->type == VEH_ROAD)) order.SetNonStopType(ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS);
return order;
}
}
@@ -1169,7 +1170,7 @@ void ShowOrdersWindow(const Vehicle *v)
if (v->owner != _local_player) {
w = AllocateWindowDescFront(&_other_orders_desc, veh);
} else {
- w = AllocateWindowDescFront((v->type == VEH_TRAIN) ? &_orders_train_desc : &_orders_desc, veh);
+ w = AllocateWindowDescFront((v->type == VEH_TRAIN || v->type == VEH_ROAD) ? &_orders_train_desc : &_orders_desc, veh);
}
if (w != NULL) {
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++;
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp
index de8bc268f..f0d20b05b 100644
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -2406,9 +2406,9 @@ static const byte _enter_station_speedtable[12] = {
static VehicleEnterTileStatus VehicleEnter_Station(Vehicle *v, TileIndex tile, int x, int y)
{
StationID station_id = GetStationIndex(tile);
- if (!v->current_order.ShouldStopAtStation(v, station_id)) return VETSB_CONTINUE;
if (v->type == VEH_TRAIN) {
+ if (!v->current_order.ShouldStopAtStation(v, station_id)) return VETSB_CONTINUE;
if (IsRailwayStation(tile) && IsFrontEngine(v) &&
!IsCompatibleTrainStationTile(tile + TileOffsByDiagDir(DirToDiagDir(v->direction)), tile)) {
DiagDirection dir = DirToDiagDir(v->direction);
@@ -2436,6 +2436,8 @@ static VehicleEnterTileStatus VehicleEnter_Station(Vehicle *v, TileIndex tile, i
RoadStop *rs = GetRoadStopByTile(tile, GetRoadStopType(tile));
if (IsDriveThroughStopTile(tile)) {
+ if (!v->current_order.ShouldStopAtStation(v, station_id)) return VETSB_CONTINUE;
+
/* Vehicles entering a drive-through stop from the 'normal' side use first bay (bay 0). */
byte side = ((DirToDiagDir(v->direction) == ReverseDiagDir(GetRoadStopDir(tile))) == (v->u.road.overtaking == 0)) ? 0 : 1;