src/station_gui.cpp
branchnoai
changeset 11126 72d4c9314c72
parent 10776 07203fc29812
equal deleted inserted replaced
11111:1b984dab8cec 11126:72d4c9314c72
   166 	}
   166 	}
   167 
   167 
   168 	/** Sort stations by their waiting cargo */
   168 	/** Sort stations by their waiting cargo */
   169 	static int CDECL StationWaitingSorter(const Station* const *a, const Station* const *b)
   169 	static int CDECL StationWaitingSorter(const Station* const *a, const Station* const *b)
   170 	{
   170 	{
   171 		Money sum1 = 0;
   171 		Money diff = 0;
   172 		Money sum2 = 0;
       
   173 
   172 
   174 		for (CargoID j = 0; j < NUM_CARGO; j++) {
   173 		for (CargoID j = 0; j < NUM_CARGO; j++) {
   175 			if (!HasBit(cargo_filter, j)) continue;
   174 			if (!HasBit(cargo_filter, j)) continue;
   176 			if (!(*a)->goods[j].cargo.Empty()) sum1 += GetTransportedGoodsIncome((*a)->goods[j].cargo.Count(), 20, 50, j);
   175 			if (!(*a)->goods[j].cargo.Empty()) diff += GetTransportedGoodsIncome((*a)->goods[j].cargo.Count(), 20, 50, j);
   177 			if (!(*b)->goods[j].cargo.Empty()) sum2 += GetTransportedGoodsIncome((*b)->goods[j].cargo.Count(), 20, 50, j);
   176 			if (!(*b)->goods[j].cargo.Empty()) diff -= GetTransportedGoodsIncome((*b)->goods[j].cargo.Count(), 20, 50, j);
   178 		}
   177 		}
   179 
   178 
   180 		return ClampToI32(sum1 - sum2);
   179 		return ClampToI32(diff);
   181 	}
   180 	}
   182 
   181 
   183 	/** Sort stations by their rating */
   182 	/** Sort stations by their rating */
   184 	static int CDECL StationRatingMaxSorter(const Station* const *a, const Station* const *b)
   183 	static int CDECL StationRatingMaxSorter(const Station* const *a, const Station* const *b)
   185 	{
   184 	{