Change: Expose NewGRF classes and specs as spans and simplify iteration.
This replaces some index-based loops with range loops.
This commit is contained in:

committed by
Peter Nelson

parent
052f421327
commit
77f27e0804
@@ -1109,15 +1109,11 @@ public:
|
||||
|
||||
this->station_classes.clear();
|
||||
|
||||
for (uint i = 0; i < StationClass::GetClassCount(); i++) {
|
||||
StationClassID station_class_id = (StationClassID)i;
|
||||
if (station_class_id == StationClassID::STAT_CLASS_WAYP) {
|
||||
// Skip waypoints.
|
||||
continue;
|
||||
}
|
||||
StationClass *station_class = StationClass::Get(station_class_id);
|
||||
if (station_class->GetUISpecCount() == 0) continue;
|
||||
station_classes.push_back(station_class_id);
|
||||
for (const auto &cls : StationClass::Classes()) {
|
||||
/* Skip waypoints. */
|
||||
if (cls.Index() == STAT_CLASS_WAYP) continue;
|
||||
if (cls.GetUISpecCount() == 0) continue;
|
||||
station_classes.push_back(cls.Index());
|
||||
}
|
||||
|
||||
if (_railstation.newstations) {
|
||||
|
Reference in New Issue
Block a user