summaryrefslogtreecommitdiff
path: root/src/rail.cpp
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2009-02-08 18:11:06 +0000
committerpeter1138 <peter1138@openttd.org>2009-02-08 18:11:06 +0000
commita68e0ee42f03bb48efbe91a7c6354e4561644ad4 (patch)
tree6b6f3e076c1f595d8ca3e3a57a07ad5ad48cf6fc /src/rail.cpp
parent986224519a27df1aa81445c1507907e11fa09afd (diff)
downloadopenttd-a68e0ee42f03bb48efbe91a7c6354e4561644ad4.tar.xz
(svn r15417) -Codechange: Add default rail type labels and support for per-GRF translation table.
Diffstat (limited to 'src/rail.cpp')
-rw-r--r--src/rail.cpp12
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;
+}