diff options
Diffstat (limited to 'src/newgrf_railtype.cpp')
-rw-r--r-- | src/newgrf_railtype.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/newgrf_railtype.cpp b/src/newgrf_railtype.cpp index de857f6a6..d4f6dcd4c 100644 --- a/src/newgrf_railtype.cpp +++ b/src/newgrf_railtype.cpp @@ -130,13 +130,12 @@ SpriteID GetCustomRailSprite(const RailtypeInfo *rti, TileIndex tile, RailTypeSp uint8 GetReverseRailTypeTranslation(RailType railtype, const GRFFile *grffile) { /* No rail type table present, return rail type as-is */ - if (grffile == NULL || grffile->railtype_max == 0) return railtype; + if (grffile == NULL || grffile->railtype_list.Length() == 0) return railtype; /* Look for a matching rail type label in the table */ RailTypeLabel label = GetRailTypeInfo(railtype)->label; - for (uint i = 0; i < grffile->railtype_max; i++) { - if (label == grffile->railtype_list[i]) return i; - } + int index = grffile->railtype_list.FindIndex(label); + if (index >= 0) return index; /* If not found, return as invalid */ return 0xFF; |