summaryrefslogtreecommitdiff
path: root/src/ai/api/ai_road.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2009-03-26 19:45:45 +0000
committerfrosch <frosch@openttd.org>2009-03-26 19:45:45 +0000
commit44351cdc57f470e7fc1213e4b0b2f6b1f42e71ac (patch)
tree6d5983772ba02edc87bbe4128a094205c7955ba1 /src/ai/api/ai_road.cpp
parent19b47c1e89ea7923fa0059075aee6ce5d60be48a (diff)
downloadopenttd-44351cdc57f470e7fc1213e4b0b2f6b1f42e71ac.tar.xz
(svn r15860) -Add: AIRoad::GetRoadVehicleTypeForCargo() to tell whether a certain cargo needs a bus- or a truckstop.
Diffstat (limited to 'src/ai/api/ai_road.cpp')
-rw-r--r--src/ai/api/ai_road.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/ai/api/ai_road.cpp b/src/ai/api/ai_road.cpp
index 4cced8873..4cbce4a68 100644
--- a/src/ai/api/ai_road.cpp
+++ b/src/ai/api/ai_road.cpp
@@ -5,12 +5,18 @@
#include "ai_road.hpp"
#include "ai_map.hpp"
#include "ai_station.hpp"
+#include "ai_cargo.hpp"
#include "../../station_map.h"
#include "../../command_type.h"
#include "../../settings_type.h"
#include "../../company_func.h"
#include "../../script/squirrel_helper_type.hpp"
+/* static */ AIRoad::RoadVehicleType AIRoad::GetRoadVehicleTypeForCargo(CargoID cargo_type)
+{
+ return AICargo::HasCargoClass(cargo_type, AICargo::CC_PASSENGERS) ? ROADVEHTYPE_BUS : ROADVEHTYPE_TRUCK;
+}
+
/* static */ bool AIRoad::IsRoadTile(TileIndex tile)
{
if (!::IsValidTile(tile)) return false;