summaryrefslogtreecommitdiff
path: root/src/ai/api/ai_vehicle.cpp
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2009-05-26 22:10:13 +0000
committersmatz <smatz@openttd.org>2009-05-26 22:10:13 +0000
commit7ee882d03f4c41d8659ed82fd5be0d0efbae0a0c (patch)
tree7107a4626a58464bd677e9fb8f7576cadf1b8bf2 /src/ai/api/ai_vehicle.cpp
parentaa546e513f6b121377fd1b6cad1b727f89b66528 (diff)
downloadopenttd-7ee882d03f4c41d8659ed82fd5be0d0efbae0a0c.tar.xz
(svn r16441) -Codechange: new class SpecializedVehicle used as superclass for all vehicle types
Diffstat (limited to 'src/ai/api/ai_vehicle.cpp')
-rw-r--r--src/ai/api/ai_vehicle.cpp5
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++;
}