From 118a9bdaf12bb4b36aca12ca62da7a2ac56a742b Mon Sep 17 00:00:00 2001 From: rubidium Date: Sun, 12 Apr 2009 19:23:26 +0000 Subject: (svn r16046) -Change: when sorting on cargo ratings only take a look at the ratings of the cargoes that are 'selected'. --- src/station_gui.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src') 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 */ -- cgit v1.2.3-70-g09d2