diff options
author | Yexo <yexo@openttd.org> | 2009-02-05 01:12:49 +0000 |
---|---|---|
committer | Yexo <yexo@openttd.org> | 2009-02-05 01:12:49 +0000 |
commit | 62a11eb5a93a12994bdf84475930d0d4b7fb4315 (patch) | |
tree | 6b29d7d897ad9b7e9938b372fd066771967fc2db /src/ai/api/ai_vehiclelist.cpp | |
parent | 364e2a110dba0c792864e55d55804681c8eb9bca (diff) | |
download | openttd-62a11eb5a93a12994bdf84475930d0d4b7fb4315.tar.xz |
(svn r15345) -Add [NoAI]: Add AIVehicle::HasSharedOrders() and AIVehicleList_SharedOrders.
Diffstat (limited to 'src/ai/api/ai_vehiclelist.cpp')
-rw-r--r-- | src/ai/api/ai_vehiclelist.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/ai/api/ai_vehiclelist.cpp b/src/ai/api/ai_vehiclelist.cpp index c7e75c795..1c099910b 100644 --- a/src/ai/api/ai_vehiclelist.cpp +++ b/src/ai/api/ai_vehiclelist.cpp @@ -4,6 +4,7 @@ #include "ai_vehiclelist.hpp" #include "ai_station.hpp" +#include "ai_vehicle.hpp" #include "../../company_func.h" #include "../../vehicle_base.h" @@ -34,3 +35,17 @@ AIVehicleList_Station::AIVehicleList_Station(StationID station_id) } } } + +AIVehicleList_SharedOrders::AIVehicleList_SharedOrders(VehicleID vehicle_id) +{ + if (!AIVehicle::IsValidVehicle(vehicle_id)) return; + + Vehicle *v = GetVehicle(vehicle_id)->FirstShared(); + if (v == NULL) { + this->AddItem(vehicle_id); + return; + } + for (; v != NULL; v->NextShared()) { + this->AddItem(v->index); + } +} |