bool CanBuildVehicleInfrastructure(RoadTypeIdentifier rtid, CompanyID company, bool any_date) { if (_game_mode != GM_EDITOR && !Company::IsValidID(company)) return false; /* TODO: In SE this could differ for the player who use the scenario, should I make it GM_NORMAL only? */ if (!_settings_client.gui.disable_unsuitable_building) return true; RoadSubTypes roadsubtypes = ExistingRoadSubTypesForRoadType(rtid.basetype, company, any_date); UnitID max = _settings_game.vehicle.max_roadveh; if (max > 0) { /* Can we actually build the vehicle type? */ const Engine *e; FOR_ALL_ENGINES_OF_TYPE(e, VEH_ROAD) { if (HasBit(roadsubtypes, e->GetRoadType().subtype)) return true; } return false; } /* We should be able to build infrastructure when we have the actual vehicle type */ const Vehicle *v; FOR_ALL_VEHICLES(v) { if (v->type == VEH_ROAD && HasBit(roadsubtypes, RoadVehicle::From(v)->rtid.subtype) && v->owner == company) return true; } return false; }