Codechange: [Script] Use ScriptList::FillList() in more locations (#11762)

This commit is contained in:
Loïc Guilloux
2024-01-12 21:19:08 +01:00
committed by GitHub
parent 60da6b992e
commit 54b57fbfeb
4 changed files with 19 additions and 17 deletions

View File

@@ -21,9 +21,11 @@ ScriptStationList::ScriptStationList(ScriptStation::StationType station_type)
EnforceDeityOrCompanyModeValid_Void();
bool is_deity = ScriptCompanyMode::IsDeity();
CompanyID owner = ScriptObject::GetCompany();
for (Station *st : Station::Iterate()) {
if ((is_deity || st->owner == owner) && (st->facilities & station_type) != 0) this->AddItem(st->index);
}
ScriptList::FillList<Station>(this,
[is_deity, owner, station_type](const Station *st) {
return (is_deity || st->owner == owner) && (st->facilities & station_type) != 0;
}
);
}
ScriptStationList_Vehicle::ScriptStationList_Vehicle(VehicleID vehicle_id)