diff options
author | bjarni <bjarni@openttd.org> | 2007-06-02 15:47:38 +0000 |
---|---|---|
committer | bjarni <bjarni@openttd.org> | 2007-06-02 15:47:38 +0000 |
commit | 07e7a80a05f60fc691114ab27539e1bec4ab3676 (patch) | |
tree | 98a3e13a6f11916a471f1fcf6351acd532ba080a | |
parent | 65ff47299196f7eb8685afc300d535ecc91fd0ec (diff) | |
download | openttd-07e7a80a05f60fc691114ab27539e1bec4ab3676.tar.xz |
(svn r10025) -Fix: [build windows] sorting planes for capacity didn't check mail capacity. Now mail capacity is used if passenger capacity is the same
The sort will still resort to EngineID if both mail and passenger capacities are the same
-rw-r--r-- | src/build_vehicle_gui.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp index bfc896810..517ad7b52 100644 --- a/src/build_vehicle_gui.cpp +++ b/src/build_vehicle_gui.cpp @@ -332,13 +332,20 @@ static int CDECL AircraftEngineRunningCostSorter(const void *a, const void *b) static int CDECL AircraftEngineCargoSorter(const void *a, const void *b) { - const int va = AircraftVehInfo(*(const EngineID*)a)->passenger_capacity; - const int vb = AircraftVehInfo(*(const EngineID*)b)->passenger_capacity; - const int r = va - vb; + int va = AircraftVehInfo(*(const EngineID*)a)->passenger_capacity; + int vb = AircraftVehInfo(*(const EngineID*)b)->passenger_capacity; + int r = va - vb; if (r == 0) { - /* Use EngineID to sort instead since we want consistent sorting */ - return EngineNumberSorter(a, b); + /* The planes has the same passenger capacity. Check mail capacity instead */ + va = AircraftVehInfo(*(const EngineID*)a)->mail_capacity; + vb = AircraftVehInfo(*(const EngineID*)b)->mail_capacity; + r = va - vb; + + if (r == 0) { + /* Use EngineID to sort instead since we want consistent sorting */ + return EngineNumberSorter(a, b); + } } return _internal_sort_order ? -r : r; } |