mirror of https://github.com/OpenTTD/OpenTTD
(svn r15489) -Change [API CHANGE]: Remove AIAirport::AirportAvailable. AIAirport::IsValidAirportType now only returns true for available AirportTypes.
parent
bce1bcb0f2
commit
16954ba378
|
@ -214,7 +214,6 @@ function Regression::Airport()
|
||||||
|
|
||||||
for (local i = -1; i < 10; i++) {
|
for (local i = -1; i < 10; i++) {
|
||||||
print(" IsValidAirportType(" + i + "): " + AIAirport.IsValidAirportType(i));
|
print(" IsValidAirportType(" + i + "): " + AIAirport.IsValidAirportType(i));
|
||||||
print(" AirportAvailable(" + i + "): " + AIAirport.AirportAvailable(i));
|
|
||||||
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));
|
||||||
|
|
|
@ -576,57 +576,46 @@
|
||||||
GetHangarOfAirport(): -1
|
GetHangarOfAirport(): -1
|
||||||
GetAirportType(): 255
|
GetAirportType(): 255
|
||||||
IsValidAirportType(-1): false
|
IsValidAirportType(-1): false
|
||||||
AirportAvailable(-1): false
|
|
||||||
GetAirportWidth(-1): -1
|
GetAirportWidth(-1): -1
|
||||||
GetAirportHeight(-1): -1
|
GetAirportHeight(-1): -1
|
||||||
GetAirportCoverageRadius(-1): -1
|
GetAirportCoverageRadius(-1): -1
|
||||||
IsValidAirportType(0): true
|
IsValidAirportType(0): true
|
||||||
AirportAvailable(0): true
|
|
||||||
GetAirportWidth(0): 4
|
GetAirportWidth(0): 4
|
||||||
GetAirportHeight(0): 3
|
GetAirportHeight(0): 3
|
||||||
GetAirportCoverageRadius(0): 4
|
GetAirportCoverageRadius(0): 4
|
||||||
IsValidAirportType(1): true
|
IsValidAirportType(1): false
|
||||||
AirportAvailable(1): false
|
GetAirportWidth(1): -1
|
||||||
GetAirportWidth(1): 6
|
GetAirportHeight(1): -1
|
||||||
GetAirportHeight(1): 6
|
GetAirportCoverageRadius(1): -1
|
||||||
GetAirportCoverageRadius(1): 5
|
IsValidAirportType(2): false
|
||||||
IsValidAirportType(2): true
|
GetAirportWidth(2): -1
|
||||||
AirportAvailable(2): false
|
GetAirportHeight(2): -1
|
||||||
GetAirportWidth(2): 1
|
GetAirportCoverageRadius(2): -1
|
||||||
GetAirportHeight(2): 1
|
IsValidAirportType(3): false
|
||||||
GetAirportCoverageRadius(2): 4
|
GetAirportWidth(3): -1
|
||||||
IsValidAirportType(3): true
|
GetAirportHeight(3): -1
|
||||||
AirportAvailable(3): false
|
GetAirportCoverageRadius(3): -1
|
||||||
GetAirportWidth(3): 6
|
IsValidAirportType(4): false
|
||||||
GetAirportHeight(3): 6
|
GetAirportWidth(4): -1
|
||||||
GetAirportCoverageRadius(3): 6
|
GetAirportHeight(4): -1
|
||||||
IsValidAirportType(4): true
|
GetAirportCoverageRadius(4): -1
|
||||||
AirportAvailable(4): false
|
IsValidAirportType(5): false
|
||||||
GetAirportWidth(4): 7
|
GetAirportWidth(5): -1
|
||||||
GetAirportHeight(4): 7
|
GetAirportHeight(5): -1
|
||||||
GetAirportCoverageRadius(4): 8
|
GetAirportCoverageRadius(5): -1
|
||||||
IsValidAirportType(5): true
|
IsValidAirportType(6): false
|
||||||
AirportAvailable(5): false
|
GetAirportWidth(6): -1
|
||||||
GetAirportWidth(5): 5
|
GetAirportHeight(6): -1
|
||||||
GetAirportHeight(5): 4
|
GetAirportCoverageRadius(6): -1
|
||||||
GetAirportCoverageRadius(5): 4
|
IsValidAirportType(7): false
|
||||||
IsValidAirportType(6): true
|
GetAirportWidth(7): -1
|
||||||
AirportAvailable(6): false
|
GetAirportHeight(7): -1
|
||||||
GetAirportWidth(6): 2
|
GetAirportCoverageRadius(7): -1
|
||||||
GetAirportHeight(6): 2
|
IsValidAirportType(8): false
|
||||||
GetAirportCoverageRadius(6): 4
|
GetAirportWidth(8): -1
|
||||||
IsValidAirportType(7): true
|
GetAirportHeight(8): -1
|
||||||
AirportAvailable(7): false
|
GetAirportCoverageRadius(8): -1
|
||||||
GetAirportWidth(7): 9
|
|
||||||
GetAirportHeight(7): 11
|
|
||||||
GetAirportCoverageRadius(7): 10
|
|
||||||
IsValidAirportType(8): true
|
|
||||||
AirportAvailable(8): false
|
|
||||||
GetAirportWidth(8): 4
|
|
||||||
GetAirportHeight(8): 2
|
|
||||||
GetAirportCoverageRadius(8): 4
|
|
||||||
IsValidAirportType(9): false
|
IsValidAirportType(9): false
|
||||||
AirportAvailable(9): false
|
|
||||||
GetAirportWidth(9): -1
|
GetAirportWidth(9): -1
|
||||||
GetAirportHeight(9): -1
|
GetAirportHeight(9): -1
|
||||||
GetAirportCoverageRadius(9): -1
|
GetAirportCoverageRadius(9): -1
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
/* static */ bool AIAirport::IsValidAirportType(AirportType type)
|
/* static */ bool AIAirport::IsValidAirportType(AirportType type)
|
||||||
{
|
{
|
||||||
return type >= AT_SMALL && type <= AT_HELISTATION;
|
return type >= AT_SMALL && type <= AT_HELISTATION && HasBit(::GetValidAirports(), type);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */ bool AIAirport::IsHangarTile(TileIndex tile)
|
/* static */ bool AIAirport::IsHangarTile(TileIndex tile)
|
||||||
|
@ -28,13 +28,6 @@
|
||||||
return ::IsTileType(tile, MP_STATION) && ::IsAirport(tile);
|
return ::IsTileType(tile, MP_STATION) && ::IsAirport(tile);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */ bool AIAirport::AirportAvailable(AirportType type)
|
|
||||||
{
|
|
||||||
if (!IsValidAirportType(type)) return false;
|
|
||||||
|
|
||||||
return HasBit(::GetValidAirports(), type);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* static */ int32 AIAirport::GetAirportWidth(AirportType type)
|
/* static */ int32 AIAirport::GetAirportWidth(AirportType type)
|
||||||
{
|
{
|
||||||
if (!IsValidAirportType(type)) return -1;
|
if (!IsValidAirportType(type)) return -1;
|
||||||
|
|
|
@ -47,9 +47,9 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks whether the given AirportType is valid.
|
* Checks whether the given AirportType is valid and available.
|
||||||
* @param type The AirportType to check.
|
* @param type The AirportType to check.
|
||||||
* @return True if and only if the AirportTypeis valid.
|
* @return True if and only if the AirportType is valid and available.
|
||||||
*/
|
*/
|
||||||
static bool IsValidAirportType(AirportType type);
|
static bool IsValidAirportType(AirportType type);
|
||||||
|
|
||||||
|
@ -69,12 +69,6 @@ public:
|
||||||
*/
|
*/
|
||||||
static bool IsAirportTile(TileIndex tile);
|
static bool IsAirportTile(TileIndex tile);
|
||||||
|
|
||||||
/**
|
|
||||||
* Check if a certain airport type is already available.
|
|
||||||
* @param type The type of airport to check.
|
|
||||||
*/
|
|
||||||
static bool AirportAvailable(AirportType type);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the width of this type of airport.
|
* Get the width of this type of airport.
|
||||||
* @param type The type of airport.
|
* @param type The type of airport.
|
||||||
|
|
|
@ -41,7 +41,6 @@ void SQAIAirport_Register(Squirrel *engine) {
|
||||||
SQAIAirport.DefSQStaticMethod(engine, &AIAirport::IsValidAirportType, "IsValidAirportType", 2, "?i");
|
SQAIAirport.DefSQStaticMethod(engine, &AIAirport::IsValidAirportType, "IsValidAirportType", 2, "?i");
|
||||||
SQAIAirport.DefSQStaticMethod(engine, &AIAirport::IsHangarTile, "IsHangarTile", 2, "?i");
|
SQAIAirport.DefSQStaticMethod(engine, &AIAirport::IsHangarTile, "IsHangarTile", 2, "?i");
|
||||||
SQAIAirport.DefSQStaticMethod(engine, &AIAirport::IsAirportTile, "IsAirportTile", 2, "?i");
|
SQAIAirport.DefSQStaticMethod(engine, &AIAirport::IsAirportTile, "IsAirportTile", 2, "?i");
|
||||||
SQAIAirport.DefSQStaticMethod(engine, &AIAirport::AirportAvailable, "AirportAvailable", 2, "?i");
|
|
||||||
SQAIAirport.DefSQStaticMethod(engine, &AIAirport::GetAirportWidth, "GetAirportWidth", 2, "?i");
|
SQAIAirport.DefSQStaticMethod(engine, &AIAirport::GetAirportWidth, "GetAirportWidth", 2, "?i");
|
||||||
SQAIAirport.DefSQStaticMethod(engine, &AIAirport::GetAirportHeight, "GetAirportHeight", 2, "?i");
|
SQAIAirport.DefSQStaticMethod(engine, &AIAirport::GetAirportHeight, "GetAirportHeight", 2, "?i");
|
||||||
SQAIAirport.DefSQStaticMethod(engine, &AIAirport::GetAirportCoverageRadius, "GetAirportCoverageRadius", 2, "?i");
|
SQAIAirport.DefSQStaticMethod(engine, &AIAirport::GetAirportCoverageRadius, "GetAirportCoverageRadius", 2, "?i");
|
||||||
|
|
Loading…
Reference in New Issue