mirror of https://github.com/OpenTTD/OpenTTD
Add: [Script] GetAirportNumHelipads (#12085)
Adds a function for Scripts to get the number of helipads of an airport type.pull/12095/head
parent
a64ca2e0c5
commit
8584d1b5bb
|
@ -220,6 +220,7 @@ function Regression::Airport()
|
||||||
print(" GetAirportWidth(" + i + "): " + AIAirport.GetAirportWidth(i));
|
print(" GetAirportWidth(" + i + "): " + AIAirport.GetAirportWidth(i));
|
||||||
print(" GetAirportHeight(" + i + "): " + AIAirport.GetAirportHeight(i));
|
print(" GetAirportHeight(" + i + "): " + AIAirport.GetAirportHeight(i));
|
||||||
print(" GetAirportCoverageRadius(" + i + "): " + AIAirport.GetAirportCoverageRadius(i));
|
print(" GetAirportCoverageRadius(" + i + "): " + AIAirport.GetAirportCoverageRadius(i));
|
||||||
|
print(" GetAirportNumHelipads(" + i + "): " + AIAirport.GetAirportNumHelipads(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
print(" GetBankBalance(): " + AICompany.GetBankBalance(AICompany.COMPANY_SELF));
|
print(" GetBankBalance(): " + AICompany.GetBankBalance(AICompany.COMPANY_SELF));
|
||||||
|
|
|
@ -805,56 +805,67 @@ ERROR: IsEnd() is invalid as Begin() is never called
|
||||||
GetAirportWidth(-1): -1
|
GetAirportWidth(-1): -1
|
||||||
GetAirportHeight(-1): -1
|
GetAirportHeight(-1): -1
|
||||||
GetAirportCoverageRadius(-1): -1
|
GetAirportCoverageRadius(-1): -1
|
||||||
|
GetAirportNumHelipads(-1): -1
|
||||||
IsAirportInformationAvailable(0): true
|
IsAirportInformationAvailable(0): true
|
||||||
IsValidAirportType(0): true
|
IsValidAirportType(0): true
|
||||||
GetAirportWidth(0): 4
|
GetAirportWidth(0): 4
|
||||||
GetAirportHeight(0): 3
|
GetAirportHeight(0): 3
|
||||||
GetAirportCoverageRadius(0): 4
|
GetAirportCoverageRadius(0): 4
|
||||||
|
GetAirportNumHelipads(0): 0
|
||||||
IsAirportInformationAvailable(1): true
|
IsAirportInformationAvailable(1): true
|
||||||
IsValidAirportType(1): false
|
IsValidAirportType(1): false
|
||||||
GetAirportWidth(1): 6
|
GetAirportWidth(1): 6
|
||||||
GetAirportHeight(1): 6
|
GetAirportHeight(1): 6
|
||||||
GetAirportCoverageRadius(1): 5
|
GetAirportCoverageRadius(1): 5
|
||||||
|
GetAirportNumHelipads(1): 0
|
||||||
IsAirportInformationAvailable(2): true
|
IsAirportInformationAvailable(2): true
|
||||||
IsValidAirportType(2): false
|
IsValidAirportType(2): false
|
||||||
GetAirportWidth(2): 1
|
GetAirportWidth(2): 1
|
||||||
GetAirportHeight(2): 1
|
GetAirportHeight(2): 1
|
||||||
GetAirportCoverageRadius(2): 4
|
GetAirportCoverageRadius(2): 4
|
||||||
|
GetAirportNumHelipads(2): 1
|
||||||
IsAirportInformationAvailable(3): true
|
IsAirportInformationAvailable(3): true
|
||||||
IsValidAirportType(3): false
|
IsValidAirportType(3): false
|
||||||
GetAirportWidth(3): 6
|
GetAirportWidth(3): 6
|
||||||
GetAirportHeight(3): 6
|
GetAirportHeight(3): 6
|
||||||
GetAirportCoverageRadius(3): 6
|
GetAirportCoverageRadius(3): 6
|
||||||
|
GetAirportNumHelipads(3): 0
|
||||||
IsAirportInformationAvailable(4): true
|
IsAirportInformationAvailable(4): true
|
||||||
IsValidAirportType(4): false
|
IsValidAirportType(4): false
|
||||||
GetAirportWidth(4): 7
|
GetAirportWidth(4): 7
|
||||||
GetAirportHeight(4): 7
|
GetAirportHeight(4): 7
|
||||||
GetAirportCoverageRadius(4): 8
|
GetAirportCoverageRadius(4): 8
|
||||||
|
GetAirportNumHelipads(4): 2
|
||||||
IsAirportInformationAvailable(5): true
|
IsAirportInformationAvailable(5): true
|
||||||
IsValidAirportType(5): false
|
IsValidAirportType(5): false
|
||||||
GetAirportWidth(5): 5
|
GetAirportWidth(5): 5
|
||||||
GetAirportHeight(5): 4
|
GetAirportHeight(5): 4
|
||||||
GetAirportCoverageRadius(5): 4
|
GetAirportCoverageRadius(5): 4
|
||||||
|
GetAirportNumHelipads(5): 2
|
||||||
IsAirportInformationAvailable(6): true
|
IsAirportInformationAvailable(6): true
|
||||||
IsValidAirportType(6): false
|
IsValidAirportType(6): false
|
||||||
GetAirportWidth(6): 2
|
GetAirportWidth(6): 2
|
||||||
GetAirportHeight(6): 2
|
GetAirportHeight(6): 2
|
||||||
GetAirportCoverageRadius(6): 4
|
GetAirportCoverageRadius(6): 4
|
||||||
|
GetAirportNumHelipads(6): 1
|
||||||
IsAirportInformationAvailable(7): true
|
IsAirportInformationAvailable(7): true
|
||||||
IsValidAirportType(7): false
|
IsValidAirportType(7): false
|
||||||
GetAirportWidth(7): 9
|
GetAirportWidth(7): 9
|
||||||
GetAirportHeight(7): 11
|
GetAirportHeight(7): 11
|
||||||
GetAirportCoverageRadius(7): 10
|
GetAirportCoverageRadius(7): 10
|
||||||
|
GetAirportNumHelipads(7): 2
|
||||||
IsAirportInformationAvailable(8): true
|
IsAirportInformationAvailable(8): true
|
||||||
IsValidAirportType(8): false
|
IsValidAirportType(8): false
|
||||||
GetAirportWidth(8): 4
|
GetAirportWidth(8): 4
|
||||||
GetAirportHeight(8): 2
|
GetAirportHeight(8): 2
|
||||||
GetAirportCoverageRadius(8): 4
|
GetAirportCoverageRadius(8): 4
|
||||||
|
GetAirportNumHelipads(8): 3
|
||||||
IsAirportInformationAvailable(9): false
|
IsAirportInformationAvailable(9): false
|
||||||
IsValidAirportType(9): false
|
IsValidAirportType(9): false
|
||||||
GetAirportWidth(9): -1
|
GetAirportWidth(9): -1
|
||||||
GetAirportHeight(9): -1
|
GetAirportHeight(9): -1
|
||||||
GetAirportCoverageRadius(9): -1
|
GetAirportCoverageRadius(9): -1
|
||||||
|
GetAirportNumHelipads(9): -1
|
||||||
GetBankBalance(): 1999999790
|
GetBankBalance(): 1999999790
|
||||||
GetPrice(): 5400
|
GetPrice(): 5400
|
||||||
BuildAirport(): true
|
BuildAirport(): true
|
||||||
|
@ -9737,9 +9748,9 @@ ERROR: IsEnd() is invalid as Begin() is never called
|
||||||
--Valuate() with excessive CPU usage--
|
--Valuate() with excessive CPU usage--
|
||||||
Your script made an error: excessive CPU usage in valuator function
|
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 [Valuate()] NATIVE line [-1]
|
||||||
*FUNCTION [Start()] regression/main.nut line [2051]
|
*FUNCTION [Start()] regression/main.nut line [2052]
|
||||||
|
|
||||||
[id] 0
|
[id] 0
|
||||||
[this] TABLE
|
[this] TABLE
|
||||||
|
@ -9748,7 +9759,7 @@ Your script made an error: excessive CPU usage in valuator function
|
||||||
[this] INSTANCE
|
[this] INSTANCE
|
||||||
Your script made an error: excessive CPU usage in valuator function
|
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
|
[Infinite] CLOSURE
|
||||||
[list] INSTANCE
|
[list] INSTANCE
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
* \li AITown::ROAD_LAYOUT_RANDOM
|
* \li AITown::ROAD_LAYOUT_RANDOM
|
||||||
* \li AIVehicle::IsPrimaryVehicle
|
* \li AIVehicle::IsPrimaryVehicle
|
||||||
* \li AITileList_StationCoverage
|
* \li AITileList_StationCoverage
|
||||||
|
* \li AIAirport::GetAirportNumHelipads
|
||||||
*
|
*
|
||||||
* API removals:
|
* API removals:
|
||||||
* \li AIError::ERR_PRECONDITION_TOO_MANY_PARAMETERS, that error is never returned anymore.
|
* \li AIError::ERR_PRECONDITION_TOO_MANY_PARAMETERS, that error is never returned anymore.
|
||||||
|
|
|
@ -88,6 +88,7 @@
|
||||||
* \li GSStoryPage::IsValidStoryPageButtonFlags
|
* \li GSStoryPage::IsValidStoryPageButtonFlags
|
||||||
* \li GSStoryPage::IsValidStoryPageButtonCursor
|
* \li GSStoryPage::IsValidStoryPageButtonCursor
|
||||||
* \li GSTileList_StationCoverage
|
* \li GSTileList_StationCoverage
|
||||||
|
* \li GSAirport::GetAirportNumHelipads
|
||||||
*
|
*
|
||||||
* API removals:
|
* API removals:
|
||||||
* \li GSError::ERR_PRECONDITION_TOO_MANY_PARAMETERS, that error is never returned anymore.
|
* \li GSError::ERR_PRECONDITION_TOO_MANY_PARAMETERS, that error is never returned anymore.
|
||||||
|
|
|
@ -170,3 +170,10 @@
|
||||||
|
|
||||||
return (int64_t)GetMaintenanceCostFactor(type) * _price[PR_INFRASTRUCTURE_AIRPORT] >> 3;
|
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;
|
||||||
|
}
|
||||||
|
|
|
@ -207,6 +207,14 @@ public:
|
||||||
* @return Monthly maintenance cost of the airport type.
|
* @return Monthly maintenance cost of the airport type.
|
||||||
*/
|
*/
|
||||||
static Money GetMonthlyMaintenanceCost(AirportType 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 */
|
#endif /* SCRIPT_AIRPORT_HPP */
|
||||||
|
|
Loading…
Reference in New Issue