Codechange: Use comparator struct to sort cargo ID by predefined sort order.

This allows reuse of the comparator where a typename is used instead.
This commit is contained in:
2023-10-14 21:20:23 +01:00
committed by Peter Nelson
parent bc8e26f4e7
commit e4f94747f3
2 changed files with 7 additions and 6 deletions

View File

@@ -204,4 +204,9 @@ static inline bool IsCargoInClass(CargoID c, CargoClass cc)
using SetCargoBitIterator = SetBitIterator<CargoID, CargoTypes>;
/** Comparator to sort CargoID by according to desired order. */
struct CargoIDComparator {
bool operator() (const CargoID &lhs, const CargoID &rhs) const { return _sorted_cargo_types[lhs] < _sorted_cargo_types[rhs]; }
};
#endif /* CARGOTYPE_H */