Codechange: Replace station related FOR_ALL with range-based for loops

This commit is contained in:
glx
2019-12-15 05:55:59 +01:00
committed by Niels Martin Hansen
parent 3a14cea068
commit ddabfed1cd
27 changed files with 76 additions and 151 deletions

View File

@@ -163,8 +163,6 @@ struct BaseStation : StationPool::PoolItem<&_station_pool> {
static void PostDestructor(size_t index);
};
#define FOR_ALL_BASE_STATIONS(var) FOR_ALL_ITEMS_FROM(BaseStation, station_index, var, 0)
/**
* Class defining several overloaded accessors so we don't
* have to cast base stations that often
@@ -252,8 +250,13 @@ struct SpecializedStation : public BaseStation {
assert(IsExpected(st));
return (const T *)st;
}
/**
* Returns an iterable ensemble of all valid stations of type T
* @param from index of the first station to consider
* @return an iterable ensemble of all valid stations of type T
*/
static Pool::IterateWrapper<T> Iterate(size_t from = 0) { return Pool::IterateWrapper<T>(from); }
};
#define FOR_ALL_BASE_STATIONS_OF_TYPE(name, var) FOR_ALL_ITEMS_FROM(name, station_index, var, 0) if (name::IsExpected(var))
#endif /* BASE_STATION_BASE_H */