From 7ee882d03f4c41d8659ed82fd5be0d0efbae0a0c Mon Sep 17 00:00:00 2001 From: smatz Date: Tue, 26 May 2009 22:10:13 +0000 Subject: (svn r16441) -Codechange: new class SpecializedVehicle used as superclass for all vehicle types --- src/ai/api/ai_vehicle.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/ai/api') diff --git a/src/ai/api/ai_vehicle.cpp b/src/ai/api/ai_vehicle.cpp index fb6c8abdc..a905d42c6 100644 --- a/src/ai/api/ai_vehicle.cpp +++ b/src/ai/api/ai_vehicle.cpp @@ -28,8 +28,9 @@ if (!IsValidVehicle(vehicle_id)) return -1; int num = 1; - if (::Vehicle::Get(vehicle_id)->type == VEH_TRAIN) { - const Train *v = (Train *)::Vehicle::Get(vehicle_id); + + const Train *v = ::Train::GetIfValid(vehicle_id); + if (v != NULL) { while ((v = GetNextUnit(v)) != NULL) num++; } -- cgit v1.2.3-70-g09d2