Codechange: Use FlatSet to store and test alternate rail/road types.

This commit is contained in:
Peter Nelson
2025-09-07 14:13:57 +01:00
committed by dP
parent e301630322
commit 01fe7e329e
6 changed files with 8 additions and 8 deletions

View File

@@ -205,8 +205,7 @@ RailType GetRailTypeByLabel(RailTypeLabel label, bool allow_alternate_labels)
if (allow_alternate_labels) {
/* Test if any rail type defines the label as an alternate. */
for (RailType r = RAILTYPE_BEGIN; r != RAILTYPE_END; r++) {
const RailTypeInfo *rti = GetRailTypeInfo(r);
if (std::ranges::find(rti->alternate_labels, label) != rti->alternate_labels.end()) return r;
if (GetRailTypeInfo(r)->alternate_labels.contains(label)) return r;
}
}