(svn r17378) -Fix [NoAI]: Several AITile::* functions didn't check whether their parameters were valid

This commit is contained in:
yexo 2009-09-02 12:48:23 +00:00
parent b7f7dd77bf
commit 05433adb6d

View File

@ -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));
}