diff options
author | yexo <yexo@openttd.org> | 2010-04-09 12:02:50 +0000 |
---|---|---|
committer | yexo <yexo@openttd.org> | 2010-04-09 12:02:50 +0000 |
commit | a7e31778b3d75f73b740534c6a9d8830104f1a9c (patch) | |
tree | 70611cdfc9495ff5a86be36c49ab01444eb4475c /src/ai/api/ai_rail.cpp | |
parent | 737b003c8a1182eaaabb4051ebc57a9cdd9df929 (diff) | |
download | openttd-a7e31778b3d75f73b740534c6a9d8830104f1a9c.tar.xz |
(svn r19591) -Add: [NoAI] AIRail::GetMaxSpeed(RailType) to get the speed limit of railtypes
Diffstat (limited to 'src/ai/api/ai_rail.cpp')
-rw-r--r-- | src/ai/api/ai_rail.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/ai/api/ai_rail.cpp b/src/ai/api/ai_rail.cpp index ae349ccde..1db02e274 100644 --- a/src/ai/api/ai_rail.cpp +++ b/src/ai/api/ai_rail.cpp @@ -469,3 +469,10 @@ static bool IsValidSignalType(int signal_type) default: return -1; } } + +/* static */ int32 AIRail::GetMaxSpeed(RailType railtype) +{ + if (!AIRail::IsRailTypeAvailable(railtype)) return -1; + + return ::GetRailTypeInfo((::RailType)railtype)->max_speed; +} |