--- a/src/ai/api/ai_station.cpp Sun Aug 19 13:01:41 2007 +0000
+++ b/src/ai/api/ai_station.cpp Sun Aug 19 13:16:06 2007 +0000
@@ -8,6 +8,8 @@
#include "../../station.h"
#include "../../station_map.h"
#include "../../variables.h"
+#include "../../strings.h"
+#include "table/strings.h"
/* static */ bool AIStation::IsValidStation(StationID station_id)
{
@@ -20,6 +22,18 @@
return ::GetStationIndex(tile);
}
+/* static */ char *AIStation::GetName(StationID station_id)
+{
+ if (!AIStation::IsValidStation(station_id)) return NULL;
+
+ static const int len = 64;
+ char *station_name = MallocT<char>(len);
+
+ SetDParam(0, GetStation(station_id)->index);
+ GetString(station_name, STR_STATION, &station_name[len - 1]);
+ return station_name;
+}
+
/* static */ TileIndex AIStation::GetLocation(StationID station_id)
{
if (!AIStation::IsValidStation(station_id)) return INVALID_TILE;