static int CDECL CompareCargoRatings(Station * const *a, Station * const *b) { return (*b)->goods[type].rating - (*a)->goods[type].rating; } uint MoveGoodsToStation(CargoID type, uint amount, SourceType source_type, SourceID source_id, const StationList *all_stations) { StationList used_stations; for (Station * const *st_iter = all_stations->Begin(); st_iter != all_stations->End(); ++st_iter) { Station *st = *st_iter; used_stations.Include(st); } if (used_stations.Length() > 1) { QSortT(used_stations.Begin(), used_stations.Length(), CompareCargoRatings); } }