(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 ca755e983c
commit 79ab8cb571
7 changed files with 42 additions and 18 deletions

View File

@@ -1228,9 +1228,11 @@ static void LoadUnloadVehicle(Vehicle *v, int *cargo_left)
/* update stats */
int t;
switch (u->type) {
case VEH_TRAIN: t = u->vcache.cached_max_speed; break;
case VEH_TRAIN: /* FALL THROUGH */
case VEH_SHIP:
t = u->vcache.cached_max_speed;
break;
case VEH_ROAD: t = u->max_speed / 2; break;
case VEH_SHIP: t = u->max_speed; break;
case VEH_AIRCRAFT: t = Aircraft::From(u)->GetSpeedOldUnits(); break; // Convert to old units.
default: NOT_REACHED();
}