diff --git a/src/road.cpp b/src/road.cpp
index 399971c..7205bc1 100644
--- a/src/road.cpp
+++ b/src/road.cpp
@@ -247,3 +247,33 @@ bool RoadTypeIdentifier::UnpackIfValid(uint32 data)
assert(ret);
return result;
}
+
+/**
+ * Returns the available RoadSubTypes for the provided RoadType
+ * @param rt the RoadType to filter
+ * @param only_existing whether to return only currently introduced vehicles or also future ones
+ * @returns the existing RoadSubTypes
+ */
+RoadSubTypes ExistingRoadSubTypesForRoadType(RoadType rt, bool only_existing = false)
+{
+ RoadSubTypes used_roadsubtypes = ROADSUBTYPES_NONE;
+
+ /* Find used roadtypes */
+ Engine *e;
+ FOR_ALL_ENGINES_OF_TYPE(e, VEH_ROAD) {
+ /* Check if the subtype can be used in the current climate */
+ if (!HasBit(e->info.climates, _settings_game.game_creation.landscape)) continue;
+
+ RoadTypeIdentifier rtid = e->GetRoadType();
+ if (rtid.basetype != rt) continue;
+
+ used_roadsubtypes |= GetRoadTypeInfo(rtid)->introduces_roadtypes;
+ }
+
+ if (!only_existing) {
+ /* Get the date introduced roadtypes as well. */
+ used_roadsubtypes = AddDateIntroducedRoadTypes(rt, used_roadsubtypes, MAX_DAY);
+ }
+
+ return used_roadsubtypes;
+}