--- a/src/ai/api/ai_station.cpp Wed Jul 18 08:38:50 2007 +0000
+++ b/src/ai/api/ai_station.cpp Wed Jul 18 09:20:50 2007 +0000
@@ -4,8 +4,10 @@
#include "ai_station.hpp"
#include "ai_cargo.hpp"
+#include "../../debug.h"
#include "../../station.h"
#include "../../station_map.h"
+#include "../../variables.h"
/* static */ bool AIStation::IsValidStation(StationID station_id)
{
@@ -40,3 +42,20 @@
return ::GetStation(station_id)->goods[cargo_id].rating * 101 >> 8;
}
+
+/* static */ int32 AIStation::GetCoverageRadius(AIStation::StationType type)
+{
+ if (type == STATION_AIRPORT) {
+ DEBUG(ai, 0, "GetCoverageRadius(): coverage radius of airports needs to be requested via AIAirport::GetAirportCoverageRadius(), as it requires AirportType");
+ return 0;
+ }
+ if (!_patches.modified_catchment) return 3;
+
+ switch (type) {
+ case STATION_TRAIN: return CA_TRAIN;
+ case STATION_TRUCK_STOP: return CA_TRUCK;
+ case STATION_BUS_STOP: return CA_BUS;
+ case STATION_DOCK: return CA_DOCK;
+ default: return CA_NONE;
+ }
+}