(svn r15524) -Add [NoAI]: AIEngine::GetPower, AIEngine::GetWeight and AIEngine::GetMaxTractiveEffort.

This commit is contained in:
yexo
2009-02-19 19:44:19 +00:00
parent ce5b380a1d
commit 3491b0fab9
5 changed files with 922 additions and 85 deletions

View File

@@ -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;