Codechange: Use range-for when iterating station speclists. (#12212)

This replaces indexed access.
This commit is contained in:
Peter Nelson
2024-03-03 16:41:02 +00:00
committed by GitHub
parent b2ca6e1ac8
commit 8172e25273
3 changed files with 14 additions and 20 deletions

View File

@@ -1002,12 +1002,10 @@ void StationUpdateCachedTriggers(BaseStation *st)
/* Combine animation trigger bitmask for all station specs
* of this station. */
for (uint i = 0; i < st->speclist.size(); i++) {
const StationSpec *ss = st->speclist[i].spec;
if (ss != nullptr) {
st->cached_anim_triggers |= ss->animation.triggers;
st->cached_cargo_triggers |= ss->cargo_triggers;
}
for (const auto &sm : GetStationSpecList<StationSpec>(st)) {
if (sm.spec == nullptr) continue;
st->cached_anim_triggers |= sm.spec->animation.triggers;
st->cached_cargo_triggers |= sm.spec->cargo_triggers;
}
}