Fix send vehicle to specific depot allowing incompatible rail types

This commit is contained in:
Jonathan G Rennison
2021-07-23 18:12:20 +01:00
parent 382955396f
commit fd0cb63963
2 changed files with 3 additions and 1 deletions

View File

@@ -3864,6 +3864,7 @@ public:
const Vehicle *v = Vehicle::Get(this->window_number);
if (IsDepotTile(tile) && GetDepotVehicleType(tile) == v->type && IsInfraTileUsageAllowed(v->type, v->owner, tile)) {
if (v->type == VEH_ROAD && (GetPresentRoadTypes(tile) & RoadVehicle::From(v)->compatible_roadtypes) == 0) return;
if (v->type == VEH_TRAIN && !HasBit(Train::From(v)->compatible_railtypes, GetRailType(tile))) return;
DoCommandP(v->tile, v->index | (this->depot_select_ctrl_pressed ? DEPOT_SERVICE : 0U) | DEPOT_SPECIFIC, tile, GetCmdSendToDepot(v));
ResetObjectToPlace();
this->RaiseButtons();