mirror of https://github.com/OpenTTD/OpenTTD.git
Merge f88b35d320
into 3b80a8255f
This commit is contained in:
commit
7443dcf5d7
|
@ -231,6 +231,7 @@ function Regression::Airport()
|
|||
print(" GetAirportType(): " + AIAirport.GetAirportType(32119));
|
||||
print(" GetHangarOfAirport(): " + AIAirport.GetHangarOfAirport(32116));
|
||||
print(" IsHangarTile(): " + AIAirport.IsHangarTile(32119));
|
||||
print(" GetTileOfAirport(): " + AIAirport.GetTileOfAirport(32119));
|
||||
print(" IsAirportTile(): " + AIAirport.IsAirportTile(32119));
|
||||
print(" GetAirportType(): " + AIAirport.GetAirportType(32119));
|
||||
print(" GetBankBalance(): " + AICompany.GetBankBalance(AICompany.COMPANY_SELF));
|
||||
|
|
|
@ -874,6 +874,7 @@ ERROR: IsEnd() is invalid as Begin() is never called
|
|||
GetAirportType(): 0
|
||||
GetHangarOfAirport(): 32119
|
||||
IsHangarTile(): true
|
||||
GetTileOfAirport(): 32116
|
||||
IsAirportTile(): true
|
||||
GetAirportType(): 0
|
||||
GetBankBalance(): 1999989890
|
||||
|
@ -9748,9 +9749,9 @@ ERROR: IsEnd() is invalid as Begin() is never called
|
|||
--Valuate() with excessive CPU usage--
|
||||
Your script made an error: excessive CPU usage in valuator function
|
||||
|
||||
*FUNCTION [unknown()] regression/main.nut line [2051]
|
||||
*FUNCTION [unknown()] regression/main.nut line [2052]
|
||||
*FUNCTION [Valuate()] NATIVE line [-1]
|
||||
*FUNCTION [Start()] regression/main.nut line [2052]
|
||||
*FUNCTION [Start()] regression/main.nut line [2053]
|
||||
|
||||
[id] 0
|
||||
[this] TABLE
|
||||
|
@ -9759,7 +9760,7 @@ Your script made an error: excessive CPU usage in valuator function
|
|||
[this] INSTANCE
|
||||
Your script made an error: excessive CPU usage in valuator function
|
||||
|
||||
*FUNCTION [Start()] regression/main.nut line [2052]
|
||||
*FUNCTION [Start()] regression/main.nut line [2053]
|
||||
|
||||
[Infinite] CLOSURE
|
||||
[list] INSTANCE
|
||||
|
|
|
@ -17,6 +17,9 @@
|
|||
*
|
||||
* This version is not yet released. The following changes are not set in stone yet.
|
||||
*
|
||||
* API additions:
|
||||
* \li AIAirport::GetTileOfAirport
|
||||
*
|
||||
* \b 14.0
|
||||
*
|
||||
* API additions:
|
||||
|
|
|
@ -17,6 +17,9 @@
|
|||
*
|
||||
* This version is not yet released. The following changes are not set in stone yet.
|
||||
*
|
||||
* API additions:
|
||||
* \li GSAirport::GetTileOfAirport
|
||||
*
|
||||
* \b 14.0
|
||||
*
|
||||
* API additions:
|
||||
|
|
|
@ -116,6 +116,27 @@
|
|||
return st->airport.GetHangarTile(0);
|
||||
}
|
||||
|
||||
/* static */ TileIndex ScriptAirport::GetTileOfAirport(TileIndex tile)
|
||||
{
|
||||
EnforceDeityOrCompanyModeValid(INVALID_TILE);
|
||||
if (!::IsValidTile(tile)) return INVALID_TILE;
|
||||
if (!::IsTileType(tile, MP_STATION)) return INVALID_TILE;
|
||||
|
||||
const ::Station *st = ::Station::GetByTile(tile);
|
||||
if (st->owner != ScriptObject::GetCompany() && ScriptCompanyMode::IsValid()) return INVALID_TILE;
|
||||
if ((st->facilities & FACIL_AIRPORT) == 0) return INVALID_TILE;
|
||||
|
||||
for (const TileIndex &t : st->airport) {
|
||||
if (!IsAirportTile(t)) continue;
|
||||
if (IsHangarTile(t)) continue;
|
||||
if (::Station::GetByTile(t)->index != st->index) continue;
|
||||
|
||||
return t;
|
||||
}
|
||||
|
||||
NOT_REACHED();
|
||||
}
|
||||
|
||||
/* static */ ScriptAirport::AirportType ScriptAirport::GetAirportType(TileIndex tile)
|
||||
{
|
||||
if (!ScriptTile::IsStationTile(tile)) return AT_INVALID;
|
||||
|
|
|
@ -134,6 +134,16 @@ public:
|
|||
*/
|
||||
static TileIndex GetHangarOfAirport(TileIndex tile);
|
||||
|
||||
/**
|
||||
* Get a tile of the airport guaranteed not to be hangar.
|
||||
* @param tile Any tile of the airport.
|
||||
* @pre ScriptMap::IsValidTile(tile).
|
||||
* @return The first non-hangar tile of the airport.
|
||||
* @note Use this when assigning orders to aircraft when intending to use the
|
||||
* airport as a station destination.
|
||||
*/
|
||||
static TileIndex GetTileOfAirport(TileIndex tile);
|
||||
|
||||
/**
|
||||
* Builds a airport with tile at the topleft corner.
|
||||
* @param tile The topleft corner of the airport.
|
||||
|
|
Loading…
Reference in New Issue