summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorskidd13 <skidd13@openttd.org>2008-06-23 22:51:21 +0000
committerskidd13 <skidd13@openttd.org>2008-06-23 22:51:21 +0000
commit241435226c19ef7a4359a7205bf9ebcb72a9138a (patch)
tree1f2f8c67b6b48bdb241f6729ae531da4ed843951
parentc8d2db3e0442adffd4ac89da549079733f037960 (diff)
downloadopenttd-241435226c19ef7a4359a7205bf9ebcb72a9138a.tar.xz
(svn r13617) -Codechange: calculate the diff in StationWaitingSorter directly
-rw-r--r--src/station_gui.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/station_gui.cpp b/src/station_gui.cpp
index 50fa33445..881ec021c 100644
--- a/src/station_gui.cpp
+++ b/src/station_gui.cpp
@@ -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 */