summaryrefslogtreecommitdiff
path: root/src/ai/api/ai_vehicle.cpp
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2009-07-02 12:10:39 +0000
committersmatz <smatz@openttd.org>2009-07-02 12:10:39 +0000
commit6a0855f0d1cd953c8774a03a1abc06553310f1a5 (patch)
treec97c8f2c0ef33f4795f38083438e44185de9f248 /src/ai/api/ai_vehicle.cpp
parent4d14c1b534947ed38780995af4d68bd67b4ae095 (diff)
downloadopenttd-6a0855f0d1cd953c8774a03a1abc06553310f1a5.tar.xz
(svn r16723) -Codechange: make GetNextArticPart(), GetLastEnginePart(), GetNextVehicle(), GetPrevVehicle(), GetNextUnit(), GetPrevUnit() members of Train
Diffstat (limited to 'src/ai/api/ai_vehicle.cpp')
-rw-r--r--src/ai/api/ai_vehicle.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/ai/api/ai_vehicle.cpp b/src/ai/api/ai_vehicle.cpp
index e98dc2ebc..f86eed7fd 100644
--- a/src/ai/api/ai_vehicle.cpp
+++ b/src/ai/api/ai_vehicle.cpp
@@ -31,7 +31,7 @@
const Train *v = ::Train::GetIfValid(vehicle_id);
if (v != NULL) {
- while ((v = GetNextUnit(v)) != NULL) num++;
+ while ((v = v->GetNextUnit()) != NULL) num++;
}
return num;
@@ -87,11 +87,11 @@
EnforcePrecondition(false, dest_vehicle_id == -1 || ::Vehicle::Get(dest_vehicle_id)->type == VEH_TRAIN);
const Train *v = ::Train::Get(source_vehicle_id);
- while (source_wagon-- > 0) v = GetNextUnit(v);
+ while (source_wagon-- > 0) v = v->GetNextUnit();
const Train *w = NULL;
if (dest_vehicle_id != -1) {
w = ::Train::Get(dest_vehicle_id);
- while (dest_wagon-- > 0) w = GetNextUnit(w);
+ while (dest_wagon-- > 0) w = w->GetNextUnit();
}
return AIObject::DoCommand(0, v->index | ((w == NULL ? INVALID_VEHICLE : w->index) << 16), move_attached_wagons ? 1 : 0, CMD_MOVE_RAIL_VEHICLE);
@@ -138,7 +138,7 @@
EnforcePrecondition(false, ::Vehicle::Get(vehicle_id)->type == VEH_TRAIN);
const Train *v = ::Train::Get(vehicle_id);
- while (wagon-- > 0) v = GetNextUnit(v);
+ while (wagon-- > 0) v = v->GetNextUnit();
return AIObject::DoCommand(0, v->index, sell_attached_wagons ? 1 : 0, CMD_SELL_RAIL_WAGON);
}
@@ -244,7 +244,7 @@
const Vehicle *v = ::Vehicle::Get(vehicle_id);
if (v->type == VEH_TRAIN) {
- while (wagon-- > 0) v = GetNextUnit(::Train::From(v));
+ while (wagon-- > 0) v = ::Train::From(v)->GetNextUnit();
}
return v->engine_type;
}
@@ -282,7 +282,7 @@
const Vehicle *v = ::Vehicle::Get(vehicle_id);
if (v->type == VEH_TRAIN) {
- while (wagon-- > 0) v = GetNextUnit(::Train::From(v));
+ while (wagon-- > 0) v = ::Train::From(v)->GetNextUnit();
}
return v->age;
}