changeset 14148:6b64f6a6535e draft

(svn r18696) -Fix [FS#3404]: AITile::IsCoastTile returned false for coast tiles with trees on them.
author yexo <yexo@openttd.org>
date Sun, 03 Jan 2010 12:42:50 +0000
parents 67221422c041
children c1109b4a2d8a
files src/ai/api/ai_tile.cpp src/ai/api/ai_tile.hpp
diffstat 2 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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)
--- a/src/ai/api/ai_tile.hpp
+++ b/src/ai/api/ai_tile.hpp
@@ -140,7 +140,8 @@
 	 * @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);