(svn r15417) -Codechange: Add default rail type labels and support for per-GRF translation table.

This commit is contained in:
peter1138
2009-02-08 18:11:06 +00:00
parent 986224519a
commit a68e0ee42f
6 changed files with 83 additions and 2 deletions

View File

@@ -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;
}