diff options
author | terkhen <terkhen@openttd.org> | 2010-12-14 21:33:53 +0000 |
---|---|---|
committer | terkhen <terkhen@openttd.org> | 2010-12-14 21:33:53 +0000 |
commit | 48b7916458de4b2cdbc226a4a6ab078db4c77e73 (patch) | |
tree | c3a49ca7a91890042ca56765574bc40a54c15f96 /src/ai | |
parent | a93944e765776c6e9a2bd556457cd93748068da6 (diff) | |
download | openttd-48b7916458de4b2cdbc226a4a6ab078db4c77e73.tar.xz |
(svn r21521) -Codechange: Unify some cached values that were present in both road vehicles and trains.
Diffstat (limited to 'src/ai')
-rw-r--r-- | src/ai/api/ai_vehicle.cpp | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/src/ai/api/ai_vehicle.cpp b/src/ai/api/ai_vehicle.cpp index 2aad40f60..7ece9cdef 100644 --- a/src/ai/api/ai_vehicle.cpp +++ b/src/ai/api/ai_vehicle.cpp @@ -48,11 +48,7 @@ if (!IsValidVehicle(vehicle_id)) return -1; const Vehicle *v = ::Vehicle::Get(vehicle_id); - switch (v->type) { - 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; - } + return v->IsGroundVehicle() ? v->GetGroundVehicleCache()->cached_total_length : -1; } /* static */ VehicleID AIVehicle::BuildVehicle(TileIndex depot, EngineID engine_id) |