Mercurial > hg > openttd
changeset 9580:5ef52e2f0601 draft
(svn r13617) -Codechange: calculate the diff in StationWaitingSorter directly
author | skidd13 <skidd13@openttd.org> |
---|---|
date | Mon, 23 Jun 2008 22:51:21 +0000 |
parents | ef01ab519589 |
children | 9a3e1ee617ce |
files | src/station_gui.cpp |
diffstat | 1 files changed, 4 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/station_gui.cpp +++ b/src/station_gui.cpp @@ -168,16 +168,15 @@ /** 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 */