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 Peter Nelson
parent 97674ac2a2
commit 4d40966303
6 changed files with 8 additions and 8 deletions
+1 -2
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;
}
}