diff options
Diffstat (limited to 'src/rail.cpp')
-rw-r--r-- | src/rail.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/rail.cpp b/src/rail.cpp index ddc716206..aa5ade657 100644 --- a/src/rail.cpp +++ b/src/rail.cpp @@ -207,3 +207,15 @@ RailTypes GetCompanyRailtypes(CompanyID company) return rt; } + +RailType GetRailTypeByLabel(RailTypeLabel label) +{ + /* Loop through each rail type until the label is found */ + for (RailType r = RAILTYPE_BEGIN; r != RAILTYPE_END; r++) { + const RailtypeInfo *rti = GetRailTypeInfo(r); + if (rti->label == label) return r; + } + + /* No matching label was found, so it is invalid */ + return INVALID_RAILTYPE; +} |