Fix incorrect check preventing ordering road vehicles to incompatible depots

pull/379/head
Jonathan G Rennison 2 years ago
parent d3efa2afe0
commit 5f511f8a65

@ -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);
}
}

@ -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;
}

@ -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);

Loading…
Cancel
Save