diff options
author | smatz <smatz@openttd.org> | 2009-05-26 22:10:13 +0000 |
---|---|---|
committer | smatz <smatz@openttd.org> | 2009-05-26 22:10:13 +0000 |
commit | 7ee882d03f4c41d8659ed82fd5be0d0efbae0a0c (patch) | |
tree | 7107a4626a58464bd677e9fb8f7576cadf1b8bf2 /src/ai | |
parent | aa546e513f6b121377fd1b6cad1b727f89b66528 (diff) | |
download | openttd-7ee882d03f4c41d8659ed82fd5be0d0efbae0a0c.tar.xz |
(svn r16441) -Codechange: new class SpecializedVehicle used as superclass for all vehicle types
Diffstat (limited to 'src/ai')
-rw-r--r-- | src/ai/api/ai_vehicle.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
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++; } |