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:
Peter Nelson
2024-04-09 17:54:43 +01:00
committed by Peter Nelson
parent 052f421327
commit 77f27e0804
6 changed files with 40 additions and 40 deletions

View File

@@ -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);