summaryrefslogtreecommitdiff
path: root/src/script/api/script_airport.cpp
diff options
context:
space:
mode:
authorSamu <dj_samu@hotmail.com>2018-09-14 13:03:52 +0100
committerNiels Martin Hansen <nielsm@indvikleren.dk>2018-11-01 18:06:08 +0100
commit1e68b9b3e6487c8c95c5d8dac89c04ea06d1d9b5 (patch)
treeef4e425dd7241c0b230feba91dfba9b4267157c2 /src/script/api/script_airport.cpp
parent4703cd433d18c8c6d144a0e279891cf039add6e1 (diff)
downloadopenttd-1e68b9b3e6487c8c95c5d8dac89c04ea06d1d9b5.tar.xz
Add: AI/GS GetMonthlyMaintenanceCost (#6897)
API addition which allows AI/GS scripts to retrieve the monthly maintenance cost of an airport type.
Diffstat (limited to 'src/script/api/script_airport.cpp')
-rw-r--r--src/script/api/script_airport.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/script/api/script_airport.cpp b/src/script/api/script_airport.cpp
index edb912609..8e19d257d 100644
--- a/src/script/api/script_airport.cpp
+++ b/src/script/api/script_airport.cpp
@@ -163,3 +163,10 @@
return AirportSpec::Get(type)->maintenance_cost;
}
+
+/* static */ Money ScriptAirport::GetMonthlyMaintenanceCost(AirportType type)
+{
+ if (!IsAirportInformationAvailable(type)) return -1;
+
+ return (int64)GetMaintenanceCostFactor(type) * _price[PR_INFRASTRUCTURE_AIRPORT] >> 3;
+}