Loading

PSEUDO CODE

  1. static int CDECL CompareCargoRatings(Station * const *a, Station * const *b)
  2. {
  3.     return (*b)->goods[type].rating - (*a)->goods[type].rating;
  4. }
  5.  
  6. uint MoveGoodsToStation(CargoID type, uint amount, SourceType source_type, SourceID source_id, const StationList *all_stations)
  7. {
  8.     StationList used_stations;
  9.  
  10.     for (Station * const *st_iter = all_stations->Begin(); st_iter != all_stations->End(); ++st_iter) {
  11.         Station *st = *st_iter;
  12.  
  13.         used_stations.Include(st);
  14.     }
  15.  
  16.     if (used_stations.Length() > 1) {
  17.         QSortT<Station *>(used_stations.Begin(), used_stations.Length(), CompareCargoRatings);
  18.     }
  19. }

Comments