Changeset - r28760:a88826ce6a33
[Not reviewed]
master
0 6 0
SamuXarick - 10 months ago 2024-02-14 20:38:32
43006711+SamuXarick@users.noreply.github.com
Add: [Script] GetAirportNumHelipads (#12085)

Adds a function for Scripts to get the number of helipads of an airport type.
6 files changed with 32 insertions and 3 deletions:
0 comments (0 inline, 0 general)
regression/regression/main.nut
Show inline comments
 
@@ -220,6 +220,7 @@ function Regression::Airport()
 
		print("  GetAirportWidth(" + i + "):               " + AIAirport.GetAirportWidth(i));
 
		print("  GetAirportHeight(" + i + "):              " + AIAirport.GetAirportHeight(i));
 
		print("  GetAirportCoverageRadius(" + i + "):      " + AIAirport.GetAirportCoverageRadius(i));
 
		print("  GetAirportNumHelipads(" + i + "):         " + AIAirport.GetAirportNumHelipads(i));
 
	}
 

	
 
	print("  GetBankBalance():     " + AICompany.GetBankBalance(AICompany.COMPANY_SELF));
regression/regression/result.txt
Show inline comments
 
@@ -805,56 +805,67 @@ ERROR: IsEnd() is invalid as Begin() is 
 
  GetAirportWidth(-1):               -1
 
  GetAirportHeight(-1):              -1
 
  GetAirportCoverageRadius(-1):      -1
 
  GetAirportNumHelipads(-1):         -1
 
  IsAirportInformationAvailable(0): true
 
  IsValidAirportType(0):            true
 
  GetAirportWidth(0):               4
 
  GetAirportHeight(0):              3
 
  GetAirportCoverageRadius(0):      4
 
  GetAirportNumHelipads(0):         0
 
  IsAirportInformationAvailable(1): true
 
  IsValidAirportType(1):            false
 
  GetAirportWidth(1):               6
 
  GetAirportHeight(1):              6
 
  GetAirportCoverageRadius(1):      5
 
  GetAirportNumHelipads(1):         0
 
  IsAirportInformationAvailable(2): true
 
  IsValidAirportType(2):            false
 
  GetAirportWidth(2):               1
 
  GetAirportHeight(2):              1
 
  GetAirportCoverageRadius(2):      4
 
  GetAirportNumHelipads(2):         1
 
  IsAirportInformationAvailable(3): true
 
  IsValidAirportType(3):            false
 
  GetAirportWidth(3):               6
 
  GetAirportHeight(3):              6
 
  GetAirportCoverageRadius(3):      6
 
  GetAirportNumHelipads(3):         0
 
  IsAirportInformationAvailable(4): true
 
  IsValidAirportType(4):            false
 
  GetAirportWidth(4):               7
 
  GetAirportHeight(4):              7
 
  GetAirportCoverageRadius(4):      8
 
  GetAirportNumHelipads(4):         2
 
  IsAirportInformationAvailable(5): true
 
  IsValidAirportType(5):            false
 
  GetAirportWidth(5):               5
 
  GetAirportHeight(5):              4
 
  GetAirportCoverageRadius(5):      4
 
  GetAirportNumHelipads(5):         2
 
  IsAirportInformationAvailable(6): true
 
  IsValidAirportType(6):            false
 
  GetAirportWidth(6):               2
 
  GetAirportHeight(6):              2
 
  GetAirportCoverageRadius(6):      4
 
  GetAirportNumHelipads(6):         1
 
  IsAirportInformationAvailable(7): true
 
  IsValidAirportType(7):            false
 
  GetAirportWidth(7):               9
 
  GetAirportHeight(7):              11
 
  GetAirportCoverageRadius(7):      10
 
  GetAirportNumHelipads(7):         2
 
  IsAirportInformationAvailable(8): true
 
  IsValidAirportType(8):            false
 
  GetAirportWidth(8):               4
 
  GetAirportHeight(8):              2
 
  GetAirportCoverageRadius(8):      4
 
  GetAirportNumHelipads(8):         3
 
  IsAirportInformationAvailable(9): false
 
  IsValidAirportType(9):            false
 
  GetAirportWidth(9):               -1
 
  GetAirportHeight(9):              -1
 
  GetAirportCoverageRadius(9):      -1
 
  GetAirportNumHelipads(9):         -1
 
  GetBankBalance():     1999999790
 
  GetPrice():           5400
 
  BuildAirport():       true
 
@@ -9737,9 +9748,9 @@ ERROR: IsEnd() is invalid as Begin() is 
 
--Valuate() with excessive CPU usage--
 
Your script made an error: excessive CPU usage in valuator function
 

	
 
*FUNCTION [unknown()] regression/main.nut line [2050]
 
*FUNCTION [unknown()] regression/main.nut line [2051]
 
*FUNCTION [Valuate()] NATIVE line [-1]
 
*FUNCTION [Start()] regression/main.nut line [2051]
 
*FUNCTION [Start()] regression/main.nut line [2052]
 

	
 
[id] 0
 
[this] TABLE
 
@@ -9748,7 +9759,7 @@ Your script made an error: excessive CPU
 
[this] INSTANCE
 
Your script made an error: excessive CPU usage in valuator function
 

	
 
*FUNCTION [Start()] regression/main.nut line [2051]
 
*FUNCTION [Start()] regression/main.nut line [2052]
 

	
 
[Infinite] CLOSURE
 
[list] INSTANCE
src/script/api/ai_changelog.hpp
Show inline comments
 
@@ -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.
src/script/api/game_changelog.hpp
Show inline comments
 
@@ -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.
src/script/api/script_airport.cpp
Show inline comments
 
@@ -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;
 
}
src/script/api/script_airport.hpp
Show inline comments
 
@@ -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 */
0 comments (0 inline, 0 general)