(svn r21099) -Codechange: Store road vehicle max speed in the vehicle cache.

This commit is contained in:
terkhen
2010-11-06 13:05:11 +00:00
parent 25d1b2f54b
commit 18e3a3ddfc
5 changed files with 20 additions and 21 deletions

View File

@@ -806,12 +806,7 @@ static int CDECL VehicleReliabilitySorter(const Vehicle * const *a, const Vehicl
/** Sort vehicles by their max speed */
static int CDECL VehicleMaxSpeedSorter(const Vehicle * const *a, const Vehicle * const *b)
{
int r = 0;
if ((*a)->type != VEH_ROAD && (*b)->type != VEH_ROAD) {
r = (*a)->vcache.cached_max_speed - (*b)->vcache.cached_max_speed;
} else {
r = (*a)->max_speed - (*b)->max_speed;
}
int r = (*a)->vcache.cached_max_speed - (*b)->vcache.cached_max_speed;
return (r != 0) ? r : VehicleNumberSorter(a, b);
}