mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-09 19:10:38 +00:00
(svn r17378) -Fix [NoAI]: Several AITile::* functions didn't check whether their parameters were valid
This commit is contained in:
parent
b7f7dd77bf
commit
05433adb6d
@ -95,31 +95,43 @@
|
||||
|
||||
/* static */ bool AITile::HasTreeOnTile(TileIndex tile)
|
||||
{
|
||||
if (!::IsValidTile(tile)) return false;
|
||||
|
||||
return ::IsTileType(tile, MP_TREES);
|
||||
}
|
||||
|
||||
/* static */ bool AITile::IsFarmTile(TileIndex tile)
|
||||
{
|
||||
if (!::IsValidTile(tile)) return false;
|
||||
|
||||
return (::IsTileType(tile, MP_CLEAR) && ::IsClearGround(tile, CLEAR_FIELDS));
|
||||
}
|
||||
|
||||
/* static */ bool AITile::IsRockTile(TileIndex tile)
|
||||
{
|
||||
if (!::IsValidTile(tile)) return false;
|
||||
|
||||
return (::IsTileType(tile, MP_CLEAR) && ::IsClearGround(tile, CLEAR_ROCKS));
|
||||
}
|
||||
|
||||
/* static */ bool AITile::IsRoughTile(TileIndex tile)
|
||||
{
|
||||
if (!::IsValidTile(tile)) return false;
|
||||
|
||||
return (::IsTileType(tile, MP_CLEAR) && ::IsClearGround(tile, CLEAR_ROUGH));
|
||||
}
|
||||
|
||||
/* static */ bool AITile::IsSnowTile(TileIndex tile)
|
||||
{
|
||||
if (!::IsValidTile(tile)) return false;
|
||||
|
||||
return (::IsTileType(tile, MP_CLEAR) && ::IsClearGround(tile, CLEAR_SNOW));
|
||||
}
|
||||
|
||||
/* static */ bool AITile::IsDesertTile(TileIndex tile)
|
||||
{
|
||||
if (!::IsValidTile(tile)) return false;
|
||||
|
||||
return (::IsTileType(tile, MP_CLEAR) && ::IsClearGround(tile, CLEAR_DESERT));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user