Add: [Script] GetAirportNumHelipads (#12085)

Adds a function for Scripts to get the number of helipads of an airport type.
This commit is contained in:
SamuXarick
2024-02-14 20:38:32 +00:00
committed by GitHub
parent a64ca2e0c5
commit 8584d1b5bb
6 changed files with 32 additions and 3 deletions

View File

@@ -22,6 +22,7 @@
* \li AITown::ROAD_LAYOUT_RANDOM
* \li AIVehicle::IsPrimaryVehicle
* \li AITileList_StationCoverage
* \li AIAirport::GetAirportNumHelipads
*
* API removals:
* \li AIError::ERR_PRECONDITION_TOO_MANY_PARAMETERS, that error is never returned anymore.

View File

@@ -88,6 +88,7 @@
* \li GSStoryPage::IsValidStoryPageButtonFlags
* \li GSStoryPage::IsValidStoryPageButtonCursor
* \li GSTileList_StationCoverage
* \li GSAirport::GetAirportNumHelipads
*
* API removals:
* \li GSError::ERR_PRECONDITION_TOO_MANY_PARAMETERS, that error is never returned anymore.

View File

@@ -170,3 +170,10 @@
return (int64_t)GetMaintenanceCostFactor(type) * _price[PR_INFRASTRUCTURE_AIRPORT] >> 3;
}
/* static */ SQInteger ScriptAirport::GetAirportNumHelipads(AirportType type)
{
if (!IsAirportInformationAvailable(type)) return -1;
return ::AirportSpec::Get(type)->fsm->num_helipads;
}

View File

@@ -207,6 +207,14 @@ public:
* @return Monthly maintenance cost of the airport type.
*/
static Money GetMonthlyMaintenanceCost(AirportType type);
/**
* Get the number of helipads of this airport type.
* @param type The airport type.
* @pre IsAirportInformationAvailable(type)
* @return Number of helipads of this type of airport. When 0 helicopters will go to normal terminals.
*/
static SQInteger GetAirportNumHelipads(AirportType type);
};
#endif /* SCRIPT_AIRPORT_HPP */