From 9e7c5235e89095b328bdd9528984a19e1716aac7 Mon Sep 17 00:00:00 2001 From: SamuXarick <43006711+SamuXarick@users.noreply.github.com> Date: Fri, 3 Jan 2020 00:04:39 +0000 Subject: [PATCH] Fix #7891: Actually check the vehicle type before casting --- src/vehicle.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vehicle.cpp b/src/vehicle.cpp index 806bf47959..2c57d970de 100644 --- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -1785,7 +1785,7 @@ bool CanBuildVehicleInfrastructure(VehicleType type, byte subtype) /* We should be able to build infrastructure when we have the actual vehicle type */ for (const Vehicle *v : Vehicle::Iterate()) { - if (type == VEH_ROAD && GetRoadTramType(RoadVehicle::From(v)->roadtype) != (RoadTramType)subtype) continue; + if (v->type == VEH_ROAD && GetRoadTramType(RoadVehicle::From(v)->roadtype) != (RoadTramType)subtype) continue; if (v->owner == _local_company && v->type == type) return true; }