# HG changeset patch # User SamuXarick <43006711+SamuXarick@users.noreply.github.com> # Date 2020-01-03 00:04:39 # Node ID b432f19ff9b337388711aba359eacd0f5c9f62a5 # Parent 2c000729240c308496ef3704bf1cd55259666e3a Fix #7891: Actually check the vehicle type before casting diff --git a/src/vehicle.cpp b/src/vehicle.cpp --- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -1785,7 +1785,7 @@ bool CanBuildVehicleInfrastructure(Vehic /* 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; }