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
@@ -145,10 +145,9 @@ public:
|
||||
|
||||
this->object_classes.clear();
|
||||
|
||||
for (uint i = 0; i < ObjectClass::GetClassCount(); i++) {
|
||||
ObjectClass *objclass = ObjectClass::Get((ObjectClassID)i);
|
||||
if (objclass->GetUISpecCount() == 0) continue; // Is this needed here?
|
||||
object_classes.push_back((ObjectClassID)i);
|
||||
for (const auto &cls : ObjectClass::Classes()) {
|
||||
if (cls.GetUISpecCount() == 0) continue; // Is this needed here?
|
||||
object_classes.push_back(cls.Index());
|
||||
}
|
||||
|
||||
this->object_classes.Filter(this->string_filter);
|
||||
|
Reference in New Issue
Block a user