Mercurial > hg > openttd
changeset 12886:9c347b6ee9e7 draft
(svn r17378) -Fix [NoAI]: Several AITile::* functions didn't check whether their parameters were valid
author | yexo <yexo@openttd.org> |
---|---|
date | Wed, 02 Sep 2009 12:48:23 +0000 |
parents | 79b60a486e6b |
children | bda0d7a566ac |
files | src/ai/api/ai_tile.cpp |
diffstat | 1 files changed, 12 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ai/api/ai_tile.cpp +++ b/src/ai/api/ai_tile.cpp @@ -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)); }