summaryrefslogtreecommitdiff
path: root/src/ai/api/ai_airport.cpp
diff options
context:
space:
mode:
authoryexo <yexo@openttd.org>2009-05-07 21:30:18 +0000
committeryexo <yexo@openttd.org>2009-05-07 21:30:18 +0000
commit9b4a32deb41a33ea1a83ee1f14256e087460e1e5 (patch)
tree0a9096550f43de69ac7d3edb71b18c56ab47a382 /src/ai/api/ai_airport.cpp
parente92efe028cc6fec6242dfa9ca2a24df150948e51 (diff)
downloadopenttd-9b4a32deb41a33ea1a83ee1f14256e087460e1e5.tar.xz
(svn r16252) -Add [NoAI]: AIAirport::GetPrice, returning the building cost of an airport
Diffstat (limited to 'src/ai/api/ai_airport.cpp')
-rw-r--r--src/ai/api/ai_airport.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/ai/api/ai_airport.cpp b/src/ai/api/ai_airport.cpp
index ed58701c3..819880f97 100644
--- a/src/ai/api/ai_airport.cpp
+++ b/src/ai/api/ai_airport.cpp
@@ -8,12 +8,21 @@
#include "../../company_func.h"
#include "../../command_type.h"
#include "../../town.h"
+#include "../../economy_func.h"
/* static */ bool AIAirport::IsValidAirportType(AirportType type)
{
return type >= AT_SMALL && type <= AT_HELISTATION && HasBit(::GetValidAirports(), type);
}
+/* static */ Money AIAirport::GetPrice(AirportType type)
+{
+ if (!IsValidAirportType(type)) return -1;
+
+ const AirportFTAClass *afc = ::GetAirport(type);
+ return _price.build_airport * afc->size_x * afc->size_y;
+}
+
/* static */ bool AIAirport::IsHangarTile(TileIndex tile)
{
if (!::IsValidTile(tile)) return false;