diff options
author | rubidium <rubidium@openttd.org> | 2009-04-12 19:23:26 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-04-12 19:23:26 +0000 |
commit | 118a9bdaf12bb4b36aca12ca62da7a2ac56a742b (patch) | |
tree | bd3c746b1cc0e651a6fdb86d926a64176b37d7f9 | |
parent | ae3ebe683446272b6d90346b8a0e6508896542b1 (diff) | |
download | openttd-118a9bdaf12bb4b36aca12ca62da7a2ac56a742b.tar.xz |
(svn r16046) -Change: when sorting on cargo ratings only take a look at the ratings of the cargoes that are 'selected'.
-rw-r--r-- | src/station_gui.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/station_gui.cpp b/src/station_gui.cpp index a39b42388..f6722758b 100644 --- a/src/station_gui.cpp +++ b/src/station_gui.cpp @@ -212,6 +212,7 @@ protected: byte maxr2 = 0; for (CargoID j = 0; j < NUM_CARGO; j++) { + if (!HasBit(cargo_filter, j)) continue; if (HasBit((*a)->goods[j].acceptance_pickup, GoodsEntry::PICKUP)) maxr1 = max(maxr1, (*a)->goods[j].rating); if (HasBit((*b)->goods[j].acceptance_pickup, GoodsEntry::PICKUP)) maxr2 = max(maxr2, (*b)->goods[j].rating); } @@ -222,15 +223,16 @@ protected: /** Sort stations by their rating */ static int CDECL StationRatingMinSorter(const Station * const *a, const Station * const *b) { - byte minr1 = 0; - byte minr2 = 0; + byte minr1 = 255; + byte minr2 = 255; for (CargoID j = 0; j < NUM_CARGO; j++) { + if (!HasBit(cargo_filter, j)) continue; if (HasBit((*a)->goods[j].acceptance_pickup, GoodsEntry::PICKUP)) minr1 = min(minr1, (*a)->goods[j].rating); if (HasBit((*b)->goods[j].acceptance_pickup, GoodsEntry::PICKUP)) minr2 = min(minr2, (*b)->goods[j].rating); } - return minr1 - minr2; + return -(minr1 - minr2); } /** Sort the stations list */ |