From 8d768f5b30b4415591fafa23345d81cc306e28ea Mon Sep 17 00:00:00 2001 From: yexo Date: Fri, 31 Jul 2009 22:38:09 +0000 Subject: (svn r17012) -Add [NoAI]: AIBaseStation::GetConstructionDate --- src/ai/api/ai_basestation.cpp | 7 +++++++ src/ai/api/ai_basestation.hpp | 7 +++++++ src/ai/api/ai_basestation.hpp.sq | 9 +++++---- 3 files changed, 19 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/ai/api/ai_basestation.cpp b/src/ai/api/ai_basestation.cpp index c9f68b3f3..0f51383e9 100644 --- a/src/ai/api/ai_basestation.cpp +++ b/src/ai/api/ai_basestation.cpp @@ -45,3 +45,10 @@ return ::BaseStation::Get(station_id)->xy; } + +/* static */ int32 AIBaseStation::GetConstructionDate(StationID station_id) +{ + if (!IsValidBaseStation(station_id)) return -1; + + return ::BaseStation::Get(station_id)->build_date; +} diff --git a/src/ai/api/ai_basestation.hpp b/src/ai/api/ai_basestation.hpp index fa103b59e..609d350c2 100644 --- a/src/ai/api/ai_basestation.hpp +++ b/src/ai/api/ai_basestation.hpp @@ -61,6 +61,13 @@ public: * @return The tile the basestation is currently on. */ static TileIndex GetLocation(StationID station_id); + + /** + * Get the last date a station part was added to this station. + * @param station_id The station to look at. + * @return The last date some part of this station was build. + */ + static int32 GetConstructionDate(StationID station_id); }; #endif /* AI_BASESTATION_HPP */ diff --git a/src/ai/api/ai_basestation.hpp.sq b/src/ai/api/ai_basestation.hpp.sq index f18e6f621..abbf7e69b 100644 --- a/src/ai/api/ai_basestation.hpp.sq +++ b/src/ai/api/ai_basestation.hpp.sq @@ -26,10 +26,11 @@ void SQAIBaseStation_Register(Squirrel *engine) { SQAIBaseStation.DefSQConst(engine, AIBaseStation::STATION_INVALID, "STATION_INVALID"); SQAIBaseStation.DefSQConst(engine, AIBaseStation::WAYPOINT_INVALID, "WAYPOINT_INVALID"); - SQAIBaseStation.DefSQStaticMethod(engine, &AIBaseStation::IsValidBaseStation, "IsValidBaseStation", 2, ".i"); - SQAIBaseStation.DefSQStaticMethod(engine, &AIBaseStation::GetName, "GetName", 2, ".i"); - SQAIBaseStation.DefSQStaticMethod(engine, &AIBaseStation::SetName, "SetName", 3, ".is"); - SQAIBaseStation.DefSQStaticMethod(engine, &AIBaseStation::GetLocation, "GetLocation", 2, ".i"); + SQAIBaseStation.DefSQStaticMethod(engine, &AIBaseStation::IsValidBaseStation, "IsValidBaseStation", 2, ".i"); + SQAIBaseStation.DefSQStaticMethod(engine, &AIBaseStation::GetName, "GetName", 2, ".i"); + SQAIBaseStation.DefSQStaticMethod(engine, &AIBaseStation::SetName, "SetName", 3, ".is"); + SQAIBaseStation.DefSQStaticMethod(engine, &AIBaseStation::GetLocation, "GetLocation", 2, ".i"); + SQAIBaseStation.DefSQStaticMethod(engine, &AIBaseStation::GetConstructionDate, "GetConstructionDate", 2, ".i"); SQAIBaseStation.PostRegister(engine); } -- cgit v1.2.3-70-g09d2