summaryrefslogtreecommitdiff
path: root/src/ai/api/ai_engine.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ai/api/ai_engine.cpp')
-rw-r--r--src/ai/api/ai_engine.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/ai/api/ai_engine.cpp b/src/ai/api/ai_engine.cpp
index 8c81862ad..c6bee2bb6 100644
--- a/src/ai/api/ai_engine.cpp
+++ b/src/ai/api/ai_engine.cpp
@@ -110,6 +110,7 @@
/* static */ int32 AIEngine::GetReliability(EngineID engine_id)
{
if (!IsValidEngine(engine_id)) return -1;
+ if (GetVehicleType(engine_id) == AIVehicle::VT_RAIL && IsWagon(engine_id)) return -1;
return (::GetEngine(engine_id)->reliability * 100 >> 16);
}
@@ -134,6 +135,7 @@
/* static */ int32 AIEngine::GetMaxAge(EngineID engine_id)
{
if (!IsValidEngine(engine_id)) return -1;
+ if (GetVehicleType(engine_id) == AIVehicle::VT_RAIL && IsWagon(engine_id)) return -1;
return ::GetEngine(engine_id)->lifelength * DAYS_IN_LEAP_YEAR;
}
@@ -145,6 +147,32 @@
return ::GetEngine(engine_id)->GetRunningCost();
}
+/* static */ int32 AIEngine::GetPower(EngineID engine_id)
+{
+ if (!IsValidEngine(engine_id)) return -1;
+ if (GetVehicleType(engine_id) != AIVehicle::VT_RAIL) return -1;
+ if (IsWagon(engine_id)) return -1;
+
+ return ::GetEngine(engine_id)->GetPower();
+}
+
+/* static */ int32 AIEngine::GetWeight(EngineID engine_id)
+{
+ if (!IsValidEngine(engine_id)) return -1;
+ if (GetVehicleType(engine_id) != AIVehicle::VT_RAIL) return -1;
+
+ return ::GetEngine(engine_id)->GetDisplayWeight();
+}
+
+/* static */ int32 AIEngine::GetMaxTractiveEffort(EngineID engine_id)
+{
+ if (!IsValidEngine(engine_id)) return -1;
+ if (GetVehicleType(engine_id) != AIVehicle::VT_RAIL) return -1;
+ if (IsWagon(engine_id)) return -1;
+
+ return ::GetEngine(engine_id)->GetDisplayMaxTractiveEffort();
+}
+
/* static */ AIVehicle::VehicleType AIEngine::GetVehicleType(EngineID engine_id)
{
if (!IsValidEngine(engine_id)) return AIVehicle::VT_INVALID;