summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCelestar <Celestar@openttd.org>2005-01-27 11:33:14 +0000
committerCelestar <Celestar@openttd.org>2005-01-27 11:33:14 +0000
commit697b619ac1271234c2bd0b30eea020ed3a612252 (patch)
tree98383693da7f970476ee9843b802ab71866e86f4
parent558dcd8ee007e485e77862cdfb625fdfc7b3403e (diff)
downloadopenttd-697b619ac1271234c2bd0b30eea020ed3a612252.tar.xz
(svn r1695) -Fix: I broke maximum speed sorting for anything but trains with the new acceleration. Sorry
-rw-r--r--vehicle_gui.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/vehicle_gui.c b/vehicle_gui.c
index b75adf451..3c9b5f441 100644
--- a/vehicle_gui.c
+++ b/vehicle_gui.c
@@ -302,17 +302,22 @@ int CDECL VehicleMaxSpeedSorter(const void *a, const void *b)
int max_speed_a = 0xFFFF, max_speed_b = 0xFFFF;
int r;
const Vehicle *ua = va, *ub = vb;
- do {
- if (RailVehInfo(ua->engine_type)->max_speed != 0)
- max_speed_a = min(max_speed_a, RailVehInfo(ua->engine_type)->max_speed);
- } while ((ua = ua->next) != NULL);
- do {
- if (RailVehInfo(ub->engine_type)->max_speed != 0)
- max_speed_b = min(max_speed_b, RailVehInfo(ub->engine_type)->max_speed);
- } while ((ub = ub->next) != NULL);
+ if (va->type == VEH_Train && vb->type == VEH_Train) {
+ do {
+ if (RailVehInfo(ua->engine_type)->max_speed != 0)
+ max_speed_a = min(max_speed_a, RailVehInfo(ua->engine_type)->max_speed);
+ } while ((ua = ua->next) != NULL);
- r = max_speed_a - max_speed_b;
+ do {
+ if (RailVehInfo(ub->engine_type)->max_speed != 0)
+ max_speed_b = min(max_speed_b, RailVehInfo(ub->engine_type)->max_speed);
+ } while ((ub = ub->next) != NULL);
+
+ r = max_speed_a - max_speed_b;
+ } else {
+ r = va->max_speed - vb->max_speed;
+ }
VEHICLEUNITNUMBERSORTER(r, va, vb);