(svn r21515) -Codechange: Use cached_total_length where appropiate.

This commit is contained in:
terkhen
2010-12-14 21:24:51 +00:00
parent 91df711d61
commit 96b98b392a
2 changed files with 2 additions and 10 deletions

View File

@@ -49,13 +49,7 @@
const Vehicle *v = ::Vehicle::Get(vehicle_id);
switch (v->type) {
case VEH_ROAD: {
uint total_length = 0;
for (const Vehicle *u = v; u != NULL; u = u->Next()) {
total_length += ::RoadVehicle::From(u)->rcache.cached_veh_length;
}
return total_length;
}
case VEH_ROAD: return ::RoadVehicle::From(v)->rcache.cached_total_length;
case VEH_TRAIN: return ::Train::From(v)->tcache.cached_total_length;
default: return -1;
}