Changeset - r23036:932cf9d10a19
[Not reviewed]
master
0 6 0
Samu - 6 years ago 2018-09-14 12:03:52
dj_samu@hotmail.com
Add: AI/GS GetMonthlyMaintenanceCost (#6897)

API addition which allows AI/GS scripts to retrieve the monthly maintenance cost of an airport type.
6 files changed with 20 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/script/api/ai/ai_airport.hpp.sq
Show inline comments
 
@@ -52,6 +52,7 @@ void SQAIAirport_Register(Squirrel *engi
 
	SQAIAirport.DefSQStaticMethod(engine, &ScriptAirport::GetNoiseLevelIncrease,         "GetNoiseLevelIncrease",         3, ".ii");
 
	SQAIAirport.DefSQStaticMethod(engine, &ScriptAirport::GetNearestTown,                "GetNearestTown",                3, ".ii");
 
	SQAIAirport.DefSQStaticMethod(engine, &ScriptAirport::GetMaintenanceCostFactor,      "GetMaintenanceCostFactor",      2, ".i");
 
	SQAIAirport.DefSQStaticMethod(engine, &ScriptAirport::GetMonthlyMaintenanceCost,     "GetMonthlyMaintenanceCost",     2, ".i");
 

	
 
	SQAIAirport.PostRegister(engine);
 
}
src/script/api/ai_changelog.hpp
Show inline comments
 
@@ -18,6 +18,8 @@
 
 * \b 1.9.0
 
 *
 
 * 1.9.0 is not yet released. The following changes are not set in stone yet.
 
 * API additions:
 
 * \li AIAirport::GetMonthlyMaintenanceCost
 
 *
 
 * \b 1.8.0
 
 *
src/script/api/game/game_airport.hpp.sq
Show inline comments
 
@@ -52,6 +52,7 @@ void SQGSAirport_Register(Squirrel *engi
 
	SQGSAirport.DefSQStaticMethod(engine, &ScriptAirport::GetNoiseLevelIncrease,         "GetNoiseLevelIncrease",         3, ".ii");
 
	SQGSAirport.DefSQStaticMethod(engine, &ScriptAirport::GetNearestTown,                "GetNearestTown",                3, ".ii");
 
	SQGSAirport.DefSQStaticMethod(engine, &ScriptAirport::GetMaintenanceCostFactor,      "GetMaintenanceCostFactor",      2, ".i");
 
	SQGSAirport.DefSQStaticMethod(engine, &ScriptAirport::GetMonthlyMaintenanceCost,     "GetMonthlyMaintenanceCost",     2, ".i");
 

	
 
	SQGSAirport.PostRegister(engine);
 
}
src/script/api/game_changelog.hpp
Show inline comments
 
@@ -19,6 +19,7 @@
 
 *
 
 * 1.9.0 is not yet released. The following changes are not set in stone yet.
 
 * API additions:
 
 * \li GSAirport::GetMonthlyMaintenanceCost
 
 * \li GSClient
 
 * \li GSClientList
 
 * \li GSClientList_Company
src/script/api/script_airport.cpp
Show inline comments
 
@@ -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;
 
}
src/script/api/script_airport.hpp
Show inline comments
 
@@ -201,6 +201,14 @@ public:
 
	 * @return Maintenance cost factor of the airport type.
 
	 */
 
	static uint16 GetMaintenanceCostFactor(AirportType type);
 

	
 
	/**
 
	 * Get the monthly maintenance cost of an airport type.
 
	 * @param type The airport type to get the monthly maintenance cost of.
 
	 * @pre IsAirportInformationAvailable(type)
 
	 * @return Monthly maintenance cost of the airport type.
 
	 */
 
	static Money GetMonthlyMaintenanceCost(AirportType type);
 
};
 

	
 
#endif /* SCRIPT_AIRPORT_HPP */
0 comments (0 inline, 0 general)