diff options
author | yexo <yexo@openttd.org> | 2010-01-03 12:42:50 +0000 |
---|---|---|
committer | yexo <yexo@openttd.org> | 2010-01-03 12:42:50 +0000 |
commit | 6e97511bcb11a83931e7ff26f3834f1d69ad1704 (patch) | |
tree | 3f8d14a586d1ac9c72571c102d4feeb36d734833 | |
parent | c73df2016a1efa1c0d9bb95f4d297f410cfffc32 (diff) | |
download | openttd-6e97511bcb11a83931e7ff26f3834f1d69ad1704.tar.xz |
(svn r18696) -Fix [FS#3404]: AITile::IsCoastTile returned false for coast tiles with trees on them.
-rw-r--r-- | src/ai/api/ai_tile.cpp | 4 | ||||
-rw-r--r-- | src/ai/api/ai_tile.hpp | 3 |
2 files changed, 5 insertions, 2 deletions
diff --git a/src/ai/api/ai_tile.cpp b/src/ai/api/ai_tile.cpp index b7e41d7fa..a1c2f1c5e 100644 --- a/src/ai/api/ai_tile.cpp +++ b/src/ai/api/ai_tile.cpp @@ -17,6 +17,7 @@ #include "../../road_map.h" #include "../../water_map.h" #include "../../clear_map.h" +#include "../../tree_map.h" #include "../../town.h" #include "../../landscape.h" @@ -68,7 +69,8 @@ { if (!::IsValidTile(tile)) return false; - return ::IsTileType(tile, MP_WATER) && ::IsCoast(tile); + return (::IsTileType(tile, MP_WATER) && ::IsCoast(tile)) || + (::IsTileType(tile, MP_TREES) && ::GetTreeGround(tile) == TREE_GROUND_SHORE); } /* static */ bool AITile::IsStationTile(TileIndex tile) diff --git a/src/ai/api/ai_tile.hpp b/src/ai/api/ai_tile.hpp index 8f5f4a102..6b254899f 100644 --- a/src/ai/api/ai_tile.hpp +++ b/src/ai/api/ai_tile.hpp @@ -140,7 +140,8 @@ public: * @param tile The tile to check. * @pre AIMap::IsValidTile(tile). * @return True if and only if the tile is a coast tile. - * @note Building on coast tiles in general is more expensive. + * @note Building on coast tiles in general is more expensive. This is not + * true if there are also trees on the tile, see #HasTreeOnTile. */ static bool IsCoastTile(TileIndex tile); |