diff options
Diffstat (limited to 'src/ai')
-rw-r--r-- | src/ai/api/ai_engine.cpp | 7 | ||||
-rw-r--r-- | src/ai/api/ai_engine.hpp | 8 | ||||
-rw-r--r-- | src/ai/api/ai_engine.hpp.sq | 1 |
3 files changed, 16 insertions, 0 deletions
diff --git a/src/ai/api/ai_engine.cpp b/src/ai/api/ai_engine.cpp index 8f5bf2167..a7519c9cd 100644 --- a/src/ai/api/ai_engine.cpp +++ b/src/ai/api/ai_engine.cpp @@ -153,6 +153,13 @@ return ::Engine::Get(engine_id)->GetDisplayMaxTractiveEffort(); } +/* static */ int32 AIEngine::GetDesignDate(EngineID engine_id) +{ + if (!IsValidEngine(engine_id)) return -1; + + return ::Engine::Get(engine_id)->intro_date; +} + /* static */ AIVehicle::VehicleType AIEngine::GetVehicleType(EngineID engine_id) { if (!IsValidEngine(engine_id)) return AIVehicle::VT_INVALID; diff --git a/src/ai/api/ai_engine.hpp b/src/ai/api/ai_engine.hpp index 93c6f2233..67179d330 100644 --- a/src/ai/api/ai_engine.hpp +++ b/src/ai/api/ai_engine.hpp @@ -153,6 +153,14 @@ public: static int32 GetMaxTractiveEffort(EngineID engine_id); /** + * Get the date this engine was designed. + * @param engine_id The engine to get the design date of. + * @pre IsValidEngine(engine_id). + * @return The date this engine was designed. + */ + static int32 GetDesignDate(EngineID engine_id); + + /** * Get the type of an engine. * @param engine_id The engine to get the type of. * @pre IsValidEngine(engine_id). diff --git a/src/ai/api/ai_engine.hpp.sq b/src/ai/api/ai_engine.hpp.sq index 75f9c4bc4..d3f4b20b0 100644 --- a/src/ai/api/ai_engine.hpp.sq +++ b/src/ai/api/ai_engine.hpp.sq @@ -31,6 +31,7 @@ void SQAIEngine_Register(Squirrel *engine) { SQAIEngine.DefSQStaticMethod(engine, &AIEngine::GetPower, "GetPower", 2, ".i"); SQAIEngine.DefSQStaticMethod(engine, &AIEngine::GetWeight, "GetWeight", 2, ".i"); SQAIEngine.DefSQStaticMethod(engine, &AIEngine::GetMaxTractiveEffort, "GetMaxTractiveEffort", 2, ".i"); + SQAIEngine.DefSQStaticMethod(engine, &AIEngine::GetDesignDate, "GetDesignDate", 2, ".i"); SQAIEngine.DefSQStaticMethod(engine, &AIEngine::GetVehicleType, "GetVehicleType", 2, ".i"); SQAIEngine.DefSQStaticMethod(engine, &AIEngine::IsWagon, "IsWagon", 2, ".i"); SQAIEngine.DefSQStaticMethod(engine, &AIEngine::CanRunOnRail, "CanRunOnRail", 3, ".ii"); |