From 5f511f8a6566670e669c21593f393d81c0258dd2 Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Tue, 29 Mar 2022 22:24:34 +0100 Subject: [PATCH] Fix incorrect check preventing ordering road vehicles to incompatible depots --- src/order_cmd.cpp | 6 +++--- src/order_gui.cpp | 2 +- src/vehicle_gui.cpp | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/order_cmd.cpp b/src/order_cmd.cpp index 57ba2b49be..7deb989172 100644 --- a/src/order_cmd.cpp +++ b/src/order_cmd.cpp @@ -1055,7 +1055,7 @@ CommandCost CmdInsertOrderIntl(DoCommandFlag flags, Vehicle *v, VehicleOrderID s case VEH_ROAD: if (!IsRoadDepotTile(dp->xy)) return CMD_ERROR; - if ((GetRoadTypes(dp->xy) & RoadVehicle::From(v)->compatible_roadtypes) == 0) return CMD_ERROR; + if ((GetPresentRoadTypes(dp->xy) & RoadVehicle::From(v)->compatible_roadtypes) == 0) return CMD_ERROR; break; case VEH_SHIP: @@ -2311,7 +2311,7 @@ CommandCost CmdCloneOrder(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 } if (OrderGoesToRoadDepot(dst, order)) { const Depot *dp = Depot::GetIfValid(order->GetDestination()); - if (!dp || (GetRoadTypes(dp->xy) & RoadVehicle::From(dst)->compatible_roadtypes) == 0) { + if (!dp || (GetPresentRoadTypes(dp->xy) & RoadVehicle::From(dst)->compatible_roadtypes) == 0) { return_cmd_error(STR_ERROR_CAN_T_COPY_SHARE_ORDER); } } @@ -2393,7 +2393,7 @@ CommandCost CmdCloneOrder(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 } if (OrderGoesToRoadDepot(dst, order)) { const Depot *dp = Depot::GetIfValid(order->GetDestination()); - if (!dp || (GetRoadTypes(dp->xy) & RoadVehicle::From(dst)->compatible_roadtypes) == 0) { + if (!dp || (GetPresentRoadTypes(dp->xy) & RoadVehicle::From(dst)->compatible_roadtypes) == 0) { return_cmd_error(STR_ERROR_CAN_T_COPY_SHARE_ORDER); } } diff --git a/src/order_gui.cpp b/src/order_gui.cpp index 65fa6dc967..d2f558bbc0 100644 --- a/src/order_gui.cpp +++ b/src/order_gui.cpp @@ -1114,7 +1114,7 @@ static Order GetOrderCmdFromTile(const Vehicle *v, TileIndex tile) /* check depot first */ if (IsDepotTypeTile(tile, (TransportType)(uint)v->type) && IsInfraTileUsageAllowed(v->type, v->owner, tile)) { - if (v->type == VEH_ROAD && ((GetRoadTypes(tile) & RoadVehicle::From(v)->compatible_roadtypes) == 0)) { + if (v->type == VEH_ROAD && ((GetPresentRoadTypes(tile) & RoadVehicle::From(v)->compatible_roadtypes) == 0)) { order.Free(); return order; } diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp index afe201665e..530b009169 100644 --- a/src/vehicle_gui.cpp +++ b/src/vehicle_gui.cpp @@ -2460,7 +2460,7 @@ public: if (IsDepotTile(tile) && GetDepotVehicleType(tile) == this->vli.vtype) { if (this->vli.type != VL_DEPOT_LIST) return; if (!IsInfraTileUsageAllowed(this->vli.vtype, this->vli.company, tile)) return; - if (this->vli.vtype == VEH_ROAD && GetRoadTypes(Depot::Get(this->vli.index)->xy) != GetRoadTypes(tile)) return; + if (this->vli.vtype == VEH_ROAD && GetPresentRoadTypes(Depot::Get(this->vli.index)->xy) != GetRoadTypes(tile)) return; DestinationID dest = (this->vli.vtype == VEH_AIRCRAFT) ? GetStationIndex(tile) : GetDepotIndex(tile); DoCommandP(0, this->vli.index | (this->vli.vtype << 16) | (OT_GOTO_DEPOT << 20), dest, CMD_MASS_CHANGE_ORDER);