Changeset - r1191:e18627621d15
[Not reviewed]
master
0 1 0
Celestar - 20 years ago 2005-01-27 11:33:14
celestar@openttd.org
(svn r1695) -Fix: I broke maximum speed sorting for anything but trains with the new acceleration. Sorry
1 file changed with 14 insertions and 9 deletions:
0 comments (0 inline, 0 general)
vehicle_gui.c
Show inline comments
 
@@ -302,17 +302,22 @@ int CDECL VehicleMaxSpeedSorter(const vo
 
	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);
 

	
 
	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);
 

	
 
	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);
 
		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;
 
		r = max_speed_a - max_speed_b;
 
	} else {
 
		r = va->max_speed - vb->max_speed;
 
	}
 

	
 
	VEHICLEUNITNUMBERSORTER(r, va, vb);
 

	
0 comments (0 inline, 0 general)