(svn r21098) -Codechange: Ships now store their max speed in the cache instead of recalculating it every time.

This commit is contained in:
terkhen
2010-11-06 13:03:17 +00:00
parent c8a56f17f8
commit 25d1b2f54b
7 changed files with 42 additions and 18 deletions

View File

@@ -807,7 +807,7 @@ static int CDECL VehicleReliabilitySorter(const Vehicle * const *a, const Vehicl
static int CDECL VehicleMaxSpeedSorter(const Vehicle * const *a, const Vehicle * const *b)
{
int r = 0;
if (((*a)->type == VEH_TRAIN && (*b)->type == VEH_TRAIN) || ((*a)->type == VEH_AIRCRAFT && (*b)->type == VEH_AIRCRAFT)) {
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;