summaryrefslogtreecommitdiff
path: root/src/script/api
diff options
context:
space:
mode:
Diffstat (limited to 'src/script/api')
-rw-r--r--src/script/api/ai/ai_station.hpp.sq1
-rw-r--r--src/script/api/script_station.cpp7
-rw-r--r--src/script/api/script_station.hpp8
3 files changed, 16 insertions, 0 deletions
diff --git a/src/script/api/ai/ai_station.hpp.sq b/src/script/api/ai/ai_station.hpp.sq
index de499d466..47072e68e 100644
--- a/src/script/api/ai/ai_station.hpp.sq
+++ b/src/script/api/ai/ai_station.hpp.sq
@@ -49,6 +49,7 @@ void SQAIStation_Register(Squirrel *engine)
SQAIStation.DefSQStaticMethod(engine, &ScriptStation::GetCargoWaiting, "GetCargoWaiting", 3, ".ii");
SQAIStation.DefSQStaticMethod(engine, &ScriptStation::GetCargoRating, "GetCargoRating", 3, ".ii");
SQAIStation.DefSQStaticMethod(engine, &ScriptStation::GetCoverageRadius, "GetCoverageRadius", 2, ".i");
+ SQAIStation.DefSQStaticMethod(engine, &ScriptStation::GetStationCoverageRadius, "GetStationCoverageRadius", 2, ".i");
SQAIStation.DefSQStaticMethod(engine, &ScriptStation::GetDistanceManhattanToTile, "GetDistanceManhattanToTile", 3, ".ii");
SQAIStation.DefSQStaticMethod(engine, &ScriptStation::GetDistanceSquareToTile, "GetDistanceSquareToTile", 3, ".ii");
SQAIStation.DefSQStaticMethod(engine, &ScriptStation::IsWithinTownInfluence, "IsWithinTownInfluence", 3, ".ii");
diff --git a/src/script/api/script_station.cpp b/src/script/api/script_station.cpp
index f91a1d2e7..4ece3da04 100644
--- a/src/script/api/script_station.cpp
+++ b/src/script/api/script_station.cpp
@@ -64,6 +64,13 @@
}
}
+/* static */ int32 ScriptStation::GetStationCoverageRadius(StationID station_id)
+{
+ if (!IsValidStation(station_id)) return -1;
+
+ return Station::Get(station_id)->GetCatchmentRadius();
+}
+
/* static */ int32 ScriptStation::GetDistanceManhattanToTile(StationID station_id, TileIndex tile)
{
if (!IsValidStation(station_id)) return -1;
diff --git a/src/script/api/script_station.hpp b/src/script/api/script_station.hpp
index 1c0dcd975..0f7e1dd0a 100644
--- a/src/script/api/script_station.hpp
+++ b/src/script/api/script_station.hpp
@@ -96,6 +96,14 @@ public:
static int32 GetCoverageRadius(ScriptStation::StationType station_type);
/**
+ * Get the coverage radius of this station.
+ * @param station_id The station to get the coverage radius of.
+ * @pre IsValidStation(station_id).
+ * @return The radius in tiles.
+ */
+ static int32 GetStationCoverageRadius(StationID station_id);
+
+ /**
* Get the manhattan distance from the tile to the ScriptStation::GetLocation()
* of the station.
* @param station_id The station to get the distance to.