mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-09 15:41:15 +00:00
(svn r13617) -Codechange: calculate the diff in StationWaitingSorter directly
This commit is contained in:
parent
469ecf4bd2
commit
6e1dd7f719
@ -168,16 +168,15 @@ protected:
|
||||
/** Sort stations by their waiting cargo */
|
||||
static int CDECL StationWaitingSorter(const Station* const *a, const Station* const *b)
|
||||
{
|
||||
Money sum1 = 0;
|
||||
Money sum2 = 0;
|
||||
Money diff = 0;
|
||||
|
||||
for (CargoID j = 0; j < NUM_CARGO; j++) {
|
||||
if (!HasBit(cargo_filter, j)) continue;
|
||||
if (!(*a)->goods[j].cargo.Empty()) sum1 += GetTransportedGoodsIncome((*a)->goods[j].cargo.Count(), 20, 50, j);
|
||||
if (!(*b)->goods[j].cargo.Empty()) sum2 += GetTransportedGoodsIncome((*b)->goods[j].cargo.Count(), 20, 50, j);
|
||||
if (!(*a)->goods[j].cargo.Empty()) diff += GetTransportedGoodsIncome((*a)->goods[j].cargo.Count(), 20, 50, j);
|
||||
if (!(*b)->goods[j].cargo.Empty()) diff -= GetTransportedGoodsIncome((*b)->goods[j].cargo.Count(), 20, 50, j);
|
||||
}
|
||||
|
||||
return ClampToI32(sum1 - sum2);
|
||||
return ClampToI32(diff);
|
||||
}
|
||||
|
||||
/** Sort stations by their rating */
|
||||
|
Loading…
Reference in New Issue
Block a user