(svn r12307) [NoAI] -Codechange: as followup on r12303 (trunk), use ::IsValidTile to check if a tile is inside the map, instead of all our custom ways noai
authortruebrain
Thu, 28 Feb 2008 00:59:01 +0000
branchnoai
changeset 9801 03a3eebd7fb7
parent 9800 ab08ca2a2018
child 9802 1095a6d029ed
(svn r12307) [NoAI] -Codechange: as followup on r12303 (trunk), use ::IsValidTile to check if a tile is inside the map, instead of all our custom ways
bin/ai/regression/regression.nut
src/ai/api/ai_airport.cpp
src/ai/api/ai_airport.hpp
src/ai/api/ai_bridge.cpp
src/ai/api/ai_bridge.hpp
src/ai/api/ai_industry.hpp
src/ai/api/ai_map.cpp
src/ai/api/ai_marine.cpp
src/ai/api/ai_marine.hpp
src/ai/api/ai_road.cpp
src/ai/api/ai_road.hpp
src/ai/api/ai_sign.hpp
src/ai/api/ai_tile.cpp
src/ai/api/ai_tile.hpp
src/ai/api/ai_tilelist.cpp
src/ai/api/ai_tilelist.hpp
src/ai/api/ai_town.hpp
src/ai/api/ai_tunnel.hpp
--- a/bin/ai/regression/regression.nut	Thu Feb 28 00:43:30 2008 +0000
+++ b/bin/ai/regression/regression.nut	Thu Feb 28 00:59:01 2008 +0000
@@ -511,7 +511,7 @@
 	print("  IsValidTile(0):   " + AIMap.IsValidTile(0));
 	print("  IsValidTile(-1):  " + AIMap.IsValidTile(-1));
 	print("  IsValidTile():    " + AIMap.IsValidTile(AIMap.GetMapSize()));
-	print("  IsValidTile():    " + AIMap.IsValidTile(AIMap.GetMapSize() - 1));
+	print("  IsValidTile():    " + AIMap.IsValidTile(AIMap.GetMapSize() - AIMap.GetMapSizeX() - 2));
 	print("  DemolishTile():   " + AIMap.DemolishTile(19592));
 	print("  DemolishTile():   " + AIMap.DemolishTile(19335));
 	print("  Distance");
--- a/src/ai/api/ai_airport.cpp	Thu Feb 28 00:43:30 2008 +0000
+++ b/src/ai/api/ai_airport.cpp	Thu Feb 28 00:59:01 2008 +0000
@@ -6,19 +6,16 @@
 #include "../../player_func.h"
 #include "../../settings_type.h"
 
-
 /* static */ bool AIAirport::IsHangarTile(TileIndex tile)
 {
-	/* Outside of the map */
-	if (tile >= ::MapSize()) return false;
+	if (!::IsValidTile(tile)) return false;
 
 	return ::IsTileType(tile, MP_STATION) && ::IsHangar(tile);
 }
 
 /* static */ bool AIAirport::IsAirportTile(TileIndex tile)
 {
-	/* Outside of the map */
-	if (tile >= ::MapSize()) return false;
+	if (!::IsValidTile(tile)) return false;
 
 	return ::IsTileType(tile, MP_STATION) && ::IsAirport(tile);
 }
@@ -49,8 +46,7 @@
 
 /* static */ bool AIAirport::BuildAirport(TileIndex tile, AirportType type)
 {
-	/* Outside of the map */
-	if (tile >= ::MapSize()) return false;
+	if (!::IsValidTile(tile)) return false;
 	if (type > AT_HELISTATION) return 0;
 
 	return AIObject::DoCommand(tile, type, 0, CMD_BUILD_AIRPORT);
@@ -58,10 +54,7 @@
 
 /* static */ bool AIAirport::RemoveAirport(TileIndex tile)
 {
-	/* Outside of the map */
-	if (tile >= ::MapSize()) return false;
-
-	/* Not a airport tile */
+	if (!::IsValidTile(tile)) return false;
 	if (!IsAirportTile(tile) && !IsHangarTile(tile)) return false;
 
 	return AIObject::DoCommand(tile, 0, 0, CMD_LANDSCAPE_CLEAR);
--- a/src/ai/api/ai_airport.hpp	Thu Feb 28 00:43:30 2008 +0000
+++ b/src/ai/api/ai_airport.hpp	Thu Feb 28 00:59:01 2008 +0000
@@ -36,7 +36,7 @@
 	/**
 	 * Checks whether the given tile is actually a tile with a hangar.
 	 * @param tile the tile to check.
-	 * @pre tile is always positive and smaller than AIMap::GetMapSize().
+	 * @pre AIMap::IsValidTile(tile).
 	 * @return true if and only if the tile has a hangar.
 	 */
 	static bool IsHangarTile(TileIndex tile);
@@ -44,7 +44,7 @@
 	/**
 	 * Checks whether the given tile is actually a tile with a airport.
 	 * @param tile the tile to check.
-	 * @pre tile is always positive and smaller than AIMap::GetMapSize().
+	 * @pre AIMap::IsValidTile(tile).
 	 * @return true if and only if the tile has a airport.
 	 */
 	static bool IsAirportTile(TileIndex tile);
@@ -80,7 +80,7 @@
 	 * Builds a airport with tile at the topleft corner.
 	 * @param tile the topleft corner of the airport.
 	 * @param type the type of airport to build.
-	 * @pre tile is always positive and smaller than AIMap::GetMapSize().
+	 * @pre AIMap::IsValidTile(tile).
 	 * @return whether the airport has been/can be build or not.
 	 */
 	static bool BuildAirport(TileIndex tile, AirportType type);
@@ -88,7 +88,7 @@
 	/**
 	 * Removes a airport.
 	 * @param tile any tile of the airport.
-	 * @pre tile is always positive and smaller than AIMap::GetMapSize().
+	 * @pre AIMap::IsValidTile(tile).
 	 * @return whether the airport has been/can be removed or not.
 	 */
 	static bool RemoveAirport(TileIndex tile);
@@ -96,7 +96,7 @@
 	/**
 	 * Get the first hanger tile of the airport.
 	 * @param tile any tile of the airport.
-	 * @pre tile is always positive and smaller than AIMap::GetMapSize().
+	 * @pre AIMap::IsValidTile(tile).
 	 * @return the first hanger tile of the airport.
 	 */
 	static TileIndex GetHangarOfAirport(TileIndex tile);
--- a/src/ai/api/ai_bridge.cpp	Thu Feb 28 00:43:30 2008 +0000
+++ b/src/ai/api/ai_bridge.cpp	Thu Feb 28 00:59:01 2008 +0000
@@ -24,8 +24,9 @@
 
 /* static */ bool AIBridge::BuildBridge(AIVehicle::VehicleType vehicle_type, BridgeID bridge_id, TileIndex start, TileIndex end)
 {
-	/* Outside of the map */
-	if (start >= ::MapSize() || end >= ::MapSize() || start == end) return false;
+	if (!::IsValidTile(start)) return false;
+	if (!::IsValidTile(end)) return false;
+	if (start == end) return false;
 	/* Not on one line */
 	if (TileX(start) != TileX(end) &&
 			TileY(start) != TileY(end)) return false;
--- a/src/ai/api/ai_bridge.hpp	Thu Feb 28 00:43:30 2008 +0000
+++ b/src/ai/api/ai_bridge.hpp	Thu Feb 28 00:59:01 2008 +0000
@@ -31,7 +31,7 @@
 	/**
 	 * Checks whether the given tile is actually a bridge start or end tile.
 	 * @param tile the tile to check.
-	 * @pre tile is always positive and smaller than AIMap::GetMapSize().
+	 * @pre AIMap::IsValidTile(tile).
 	 * @return true if and only if the tile is the beginning or end of a bridge.
 	 */
 	static bool IsBridgeTile(TileIndex tile);
@@ -42,8 +42,8 @@
 	 * @param bridge_id The bridge-type to build.
 	 * @param start Where to start the bridge.
 	 * @param end Where to end the bridge.
-	 * @pre start is always positive and smaller than AIMap::GetMapSize().
-	 * @pre end is always positive and smaller than AIMap::GetMapSize().
+	 * @pre AIMap::IsValidTile(start).
+	 * @pre AIMap::IsValidTile(end).
 	 * @pre start and end are in a straight line, i.e.
 	 *  AIMap::GetTileX(start) == AIMap::GetTileX(end) or
 	 *  AIMap::GetTileY(start) == AIMap::GetTileY(end).
@@ -55,7 +55,7 @@
 	/**
 	 * Removes a bridge, by executing it on either the start or end tile.
 	 * @param tile An end or start tile of the bridge.
-	 * @pre tile is always positive and smaller than AIMap::GetMapSize().
+	 * @pre AIMap::IsValidTile(tile).
 	 * @return Whether the bridge has been/can be removed or not.
 	 */
 	static bool RemoveBridge(TileIndex tile);
--- a/src/ai/api/ai_industry.hpp	Thu Feb 28 00:43:30 2008 +0000
+++ b/src/ai/api/ai_industry.hpp	Thu Feb 28 00:59:01 2008 +0000
@@ -76,7 +76,7 @@
 	 * @param industry_id the index of the industry.
 	 * @pre industry_id has to be valid (use IsValidIndustry()).
 	 * @return the location of the industry.
-	 * @post return value is always positive and below AIMap::GetMapSize().
+	 * @post return value is always valid with AIMap::IsValidTile().
 	 */
 	static TileIndex GetLocation(IndustryID industry_id);
 };
--- a/src/ai/api/ai_map.cpp	Thu Feb 28 00:43:30 2008 +0000
+++ b/src/ai/api/ai_map.cpp	Thu Feb 28 00:59:01 2008 +0000
@@ -5,10 +5,11 @@
 #include "ai_map.hpp"
 #include "../../command_type.h"
 #include "../../map_func.h"
+#include "../../tile_map.h"
 
 /* static */ bool AIMap::IsValidTile(TileIndex t)
 {
-	return t < AIMap::GetMapSize();
+	return ::IsValidTile(t);
 }
 
 /* static */ TileIndex AIMap::GetMapSize()
--- a/src/ai/api/ai_marine.cpp	Thu Feb 28 00:43:30 2008 +0000
+++ b/src/ai/api/ai_marine.cpp	Thu Feb 28 00:59:01 2008 +0000
@@ -9,90 +9,77 @@
 
 /* static */ bool AIMarine::IsWaterDepotTile(TileIndex tile)
 {
-	/* Outside of the map */
-	if (tile >= ::MapSize()) return false;
+	if (!::IsValidTile(tile)) return false;
 
 	return ::IsTileType(tile, MP_WATER) && ::GetWaterTileType(tile) == WATER_TILE_DEPOT;
 }
 
 /* static */ bool AIMarine::IsDockTile(TileIndex tile)
 {
-	/* Outside of the map */
-	if (tile >= ::MapSize()) return false;
+	if (!::IsValidTile(tile)) return false;
 
 	return ::IsTileType(tile, MP_STATION) && ::IsDock(tile);
 }
 
 /* static */ bool AIMarine::IsBuoyTile(TileIndex tile)
 {
-	/* Outside of the map */
-	if (tile >= ::MapSize()) return false;
+	if (!::IsValidTile(tile)) return false;
 
 	return ::IsTileType(tile, MP_STATION) && ::IsBuoy(tile);
 }
 
 /* static */ bool AIMarine::IsLockTile(TileIndex tile)
 {
-	/* Outside of the map */
-	if (tile >= ::MapSize()) return false;
+	if (!::IsValidTile(tile)) return false;
 
 	return ::IsTileType(tile, MP_WATER) && ::GetWaterTileType(tile) == WATER_TILE_LOCK;
 }
 
 /* static */ bool AIMarine::IsCanalTile(TileIndex tile)
 {
-	/* Outside of the map */
-	if (tile >= ::MapSize()) return false;
+	if (!::IsValidTile(tile)) return false;
 
 	return ::IsTileType(tile, MP_WATER) && ::IsCanal(tile);
 }
 
 /* static */ bool AIMarine::BuildWaterDepot(TileIndex tile, bool vertical)
 {
-	/* Outside of the map */
-	if (tile >= ::MapSize()) return false;
+	if (!::IsValidTile(tile)) return false;
 
 	return AIObject::DoCommand(tile, vertical, 0, CMD_BUILD_SHIP_DEPOT, false);
 }
 
 /* static */ bool AIMarine::BuildDock(TileIndex tile)
 {
-	/* Outside of the map */
-	if (tile >= ::MapSize()) return false;
+	if (!::IsValidTile(tile)) return false;
 
 	return AIObject::DoCommand(tile, 1, 0, CMD_BUILD_DOCK, false);
 }
 
 /* static */ bool AIMarine::BuildBuoy(TileIndex tile)
 {
-	/* Outside of the map */
-	if (tile >= ::MapSize()) return false;
+	if (!::IsValidTile(tile)) return false;
 
 	return AIObject::DoCommand(tile, 0, 0, CMD_BUILD_BUOY, false);
 }
 
 /* static */ bool AIMarine::BuildLock(TileIndex tile)
 {
-	/* Outside of the map */
-	if (tile >= ::MapSize()) return false;
+	if (!::IsValidTile(tile)) return false;
 
 	return AIObject::DoCommand(tile, 0, 0, CMD_BUILD_LOCK, false);
 }
 
 /* static */ bool AIMarine::BuildCanal(TileIndex tile)
 {
-	/* Outside of the map */
-	if (tile >= ::MapSize()) return false;
+	if (!::IsValidTile(tile)) return false;
 
 	return AIObject::DoCommand(tile, tile, 0, CMD_BUILD_CANAL, false);
 }
 
 /* static */ bool AIMarine::RemoveWaterDepot(TileIndex tile)
 {
-	/* Outside of the map */
-	if (tile >= ::MapSize()) return false;
-
-	/* Not a water depot tile */
+	if (!::IsValidTile(tile)) return false;
 	if (!IsWaterDepotTile(tile)) return false;
 
 	return AIObject::DoCommand(tile, 0, 0, CMD_LANDSCAPE_CLEAR, false);
@@ -100,10 +87,7 @@
 
 /* static */ bool AIMarine::RemoveDock(TileIndex tile)
 {
-	/* Outside of the map */
-	if (tile >= ::MapSize()) return false;
-
-	/* Not a dock tile */
+	if (!::IsValidTile(tile)) return false;
 	if (!IsDockTile(tile)) return false;
 
 	return AIObject::DoCommand(tile, 0, 0, CMD_LANDSCAPE_CLEAR, false);
@@ -111,10 +95,7 @@
 
 /* static */ bool AIMarine::RemoveBuoy(TileIndex tile)
 {
-	/* Outside of the map */
-	if (tile >= ::MapSize()) return false;
-
-	/* Not a buoy tile */
+	if (!::IsValidTile(tile)) return false;
 	if (!IsBuoyTile(tile)) return false;
 
 	return AIObject::DoCommand(tile, 0, 0, CMD_LANDSCAPE_CLEAR, false);
@@ -122,10 +103,7 @@
 
 /* static */ bool AIMarine::RemoveLock(TileIndex tile)
 {
-	/* Outside of the map */
-	if (tile >= ::MapSize()) return false;
-
-	/* Not a lock tile */
+	if (!::IsValidTile(tile)) return false;
 	if (!IsLockTile(tile)) return false;
 
 	return AIObject::DoCommand(tile, 0, 0, CMD_LANDSCAPE_CLEAR, false);
@@ -133,10 +111,7 @@
 
 /* static */ bool AIMarine::RemoveCanal(TileIndex tile)
 {
-	/* Outside of the map */
-	if (tile >= ::MapSize()) return false;
-
-	/* Not a canal tile */
+	if (!::IsValidTile(tile)) return false;
 	if (!IsCanalTile(tile)) return false;
 
 	return AIObject::DoCommand(tile, 0, 0, CMD_LANDSCAPE_CLEAR, false);
--- a/src/ai/api/ai_marine.hpp	Thu Feb 28 00:43:30 2008 +0000
+++ b/src/ai/api/ai_marine.hpp	Thu Feb 28 00:59:01 2008 +0000
@@ -20,7 +20,7 @@
 	/**
 	 * Checks whether the given tile is actually a tile with a water depot.
 	 * @param tile the tile to check.
-	 * @pre tile is always positive and smaller than AIMap::GetMapSize().
+	 * @pre AIMap::IsValidTile(tile).
 	 * @return true if and only if the tile has a water depot.
 	 */
 	static bool IsWaterDepotTile(TileIndex tile);
@@ -28,7 +28,7 @@
 	/**
 	 * Checks whether the given tile is actually a tile with a dock.
 	 * @param tile the tile to check.
-	 * @pre tile is always positive and smaller than AIMap::GetMapSize().
+	 * @pre AIMap::IsValidTile(tile).
 	 * @return true if and only if the tile has a dock.
 	 */
 	static bool IsDockTile(TileIndex tile);
@@ -36,7 +36,7 @@
 	/**
 	 * Checks whether the given tile is actually a tile with a buoy.
 	 * @param tile the tile to check.
-	 * @pre tile is always positive and smaller than AIMap::GetMapSize().
+	 * @pre AIMap::IsValidTile(tile).
 	 * @return true if and only if the tile has a buoy.
 	 */
 	static bool IsBuoyTile(TileIndex tile);
@@ -44,7 +44,7 @@
 	/**
 	 * Checks whether the given tile is actually a tile with a lock.
 	 * @param tile the tile to check.
-	 * @pre tile is always positive and smaller than AIMap::GetMapSize().
+	 * @pre AIMap::IsValidTile(tile).
 	 * @return true if and only if the tile has a lock.
 	 */
 	static bool IsLockTile(TileIndex tile);
@@ -52,7 +52,7 @@
 	/**
 	 * Checks whether the given tile is actually a tile with a canal.
 	 * @param tile the tile to check.
-	 * @pre tile is always positive and smaller than AIMap::GetMapSize().
+	 * @pre AIMap::IsValidTile(tile).
 	 * @return true if and only if the tile has a canal.
 	 */
 	static bool IsCanalTile(TileIndex tile);
@@ -61,7 +61,7 @@
 	 * Builds a water depot on tile.
 	 * @param tile the tile where the water depot will be build.
 	 * @param vertical if true, depot will be vertical, else horizontal.
-	 * @pre tile is always positive and smaller than AIMap::GetMapSize().
+	 * @pre AIMap::IsValidTile(tile).
 	 * @return whether the water depot has been/can be build or not.
 	 */
 	static bool BuildWaterDepot(TileIndex tile, bool vertical);
@@ -69,7 +69,7 @@
 	/**
 	 * Builds a dock where tile is the tile still on land.
 	 * @param tile the tile still on land of the dock.
-	 * @pre tile is always positive and smaller than AIMap::GetMapSize().
+	 * @pre AIMap::IsValidTile(tile).
 	 * @return whether the dock has been/can be build or not.
 	 */
 	static bool BuildDock(TileIndex tile);
@@ -77,7 +77,7 @@
 	/**
 	 * Builds a buoy on tile.
 	 * @param tile the tile where the buoy will be build.
-	 * @pre tile is always positive and smaller than AIMap::GetMapSize().
+	 * @pre AIMap::IsValidTile(tile).
 	 * @return whether the buoy has been/can be build or not.
 	 */
 	static bool BuildBuoy(TileIndex tile);
@@ -85,7 +85,7 @@
 	/**
 	 * Builds a lock on tile.
 	 * @param tile the tile where the lock will be build.
-	 * @pre tile is always positive and smaller than AIMap::GetMapSize().
+	 * @pre AIMap::IsValidTile(tile).
 	 * @return whether the lock has been/can be build or not.
 	 */
 	static bool BuildLock(TileIndex tile);
@@ -93,7 +93,7 @@
 	/**
 	 * Builds a canal on tile.
 	 * @param tile the tile where the canal will be build.
-	 * @pre tile is always positive and smaller than AIMap::GetMapSize().
+	 * @pre AIMap::IsValidTile(tile).
 	 * @return whether the canal has been/can be build or not.
 	 */
 	static bool BuildCanal(TileIndex tile);
@@ -101,7 +101,7 @@
 	/**
 	 * Removes a water depot.
 	 * @param tile any tile of the water depot.
-	 * @pre tile is always positive and smaller than AIMap::GetMapSize().
+	 * @pre AIMap::IsValidTile(tile).
 	 * @return whether the water depot has been/can be removed or not.
 	 */
 	static bool RemoveWaterDepot(TileIndex tile);
@@ -109,7 +109,7 @@
 	/**
 	 * Removes a dock.
 	 * @param tile any tile of the dock.
-	 * @pre tile is always positive and smaller than AIMap::GetMapSize().
+	 * @pre AIMap::IsValidTile(tile).
 	 * @return whether the dock has been/can be removed or not.
 	 */
 	static bool RemoveDock(TileIndex tile);
@@ -117,7 +117,7 @@
 	/**
 	 * Removes a buoy.
 	 * @param tile any tile of the buoy.
-	 * @pre tile is always positive and smaller than AIMap::GetMapSize().
+	 * @pre AIMap::IsValidTile(tile).
 	 * @return whether the buoy has been/can be removed or not.
 	 */
 	static bool RemoveBuoy(TileIndex tile);
@@ -125,7 +125,7 @@
 	/**
 	 * Removes a lock.
 	 * @param tile any tile of the lock.
-	 * @pre tile is always positive and smaller than AIMap::GetMapSize().
+	 * @pre AIMap::IsValidTile(tile).
 	 * @return whether the lock has been/can be removed or not.
 	 */
 	static bool RemoveLock(TileIndex tile);
@@ -133,7 +133,7 @@
 	/**
 	 * Removes a canal.
 	 * @param tile any tile of the canal.
-	 * @pre tile is always positive and smaller than AIMap::GetMapSize().
+	 * @pre AIMap::IsValidTile(tile).
 	 * @return whether the canal has been/can be removed or not.
 	 */
 	static bool RemoveCanal(TileIndex tile);
--- a/src/ai/api/ai_road.cpp	Thu Feb 28 00:43:30 2008 +0000
+++ b/src/ai/api/ai_road.cpp	Thu Feb 28 00:59:01 2008 +0000
@@ -8,8 +8,7 @@
 
 /* static */ bool AIRoad::IsRoadTile(TileIndex tile)
 {
-	/* Outside of the map */
-	if (tile >= ::MapSize()) return false;
+	if (!::IsValidTile(tile)) return false;
 
 	return (::IsTileType(tile, MP_ROAD) && ::GetRoadTileType(tile) != ROAD_TILE_DEPOT) ||
 			IsDriveThroughRoadStationTile(tile);
@@ -17,32 +16,29 @@
 
 /* static */ bool AIRoad::IsRoadDepotTile(TileIndex tile)
 {
-	/* Outside of the map */
-	if (tile >= ::MapSize()) return false;
+	if (!::IsValidTile(tile)) return false;
 
 	return ::IsTileType(tile, MP_ROAD) && ::GetRoadTileType(tile) == ROAD_TILE_DEPOT;
 }
 
 /* static */ bool AIRoad::IsRoadStationTile(TileIndex tile)
 {
-	/* Outside of the map */
-	if (tile >= ::MapSize()) return false;
+	if (!::IsValidTile(tile)) return false;
 
 	return ::IsRoadStopTile(tile);
 }
 
 /* static */ bool AIRoad::IsDriveThroughRoadStationTile(TileIndex tile)
 {
-	/* Outside of the map */
-	if (tile >= ::MapSize()) return false;
+	if (!::IsValidTile(tile)) return false;
 
 	return ::IsDriveThroughStopTile(tile);
 }
 
 /* static */ bool AIRoad::AreRoadTilesConnected(TileIndex t1, TileIndex t2)
 {
-	/* Outside of the map */
-	if (t1 >= ::MapSize() || t2 >= ::MapSize()) return false;
+	if (!::IsValidTile(t1)) return false;
+	if (!::IsValidTile(t2)) return false;
 
 	/* Tiles not neighbouring */
 	if ((abs((int)::TileX(t1) - (int)::TileX(t2)) + abs((int)::TileY(t1) - (int)::TileY(t2))) != 1) return false;
@@ -58,8 +54,7 @@
 
 /* static */ int32 AIRoad::GetNeighbourRoadCount(TileIndex tile)
 {
-	/* Outside of the map */
-	if (tile >= ::MapSize()) return false;
+	if (!::IsValidTile(tile)) return false;
 
 	int32 neighbour = 0;
 
@@ -94,8 +89,9 @@
 
 /* static */ bool AIRoad::BuildRoad(TileIndex start, TileIndex end)
 {
-	/* Outside of the map */
-	if (start >= ::MapSize() || end >= ::MapSize() || start == end) return false;
+	if (!::IsValidTile(start)) return false;
+	if (!::IsValidTile(end)) return false;
+	if (start == end) return false;
 	/* Not on one line */
 	if (TileX(start) != TileX(end) &&
 			TileY(start) != TileY(end)) return false;
@@ -105,8 +101,9 @@
 
 /* static */ bool AIRoad::BuildRoadFull(TileIndex start, TileIndex end)
 {
-	/* Outside of the map */
-	if (start >= ::MapSize() || end >= ::MapSize() || start == end) return false;
+	if (!::IsValidTile(start)) return false;
+	if (!::IsValidTile(end)) return false;
+	if (start == end) return false;
 	/* Not on one line */
 	if (TileX(start) != TileX(end) &&
 			TileY(start) != TileY(end)) return false;
@@ -116,8 +113,9 @@
 
 /* static */ bool AIRoad::BuildRoadDepot(TileIndex tile, TileIndex front)
 {
-	/* Outside of the map */
-	if (tile >= ::MapSize() || tile == front) return false;
+	if (!::IsValidTile(tile)) return false;
+	if (!::IsValidTile(front)) return false;
+	if (tile == front) return false;
 
 	uint entrance_dir = (TileX(tile) == TileX(front)) ? (TileY(tile) < TileY(front) ? 1 : 3) : (TileX(tile) < TileX(front) ? 2 : 0);
 
@@ -126,8 +124,9 @@
 
 /* static */ bool AIRoad::BuildRoadStation(TileIndex tile, TileIndex front, bool truck, bool drive_through)
 {
-	/* Outside of the map */
-	if (tile >= ::MapSize() || tile == front) return false;
+	if (!::IsValidTile(tile)) return false;
+	if (!::IsValidTile(front)) return false;
+	if (tile == front) return false;
 
 	uint entrance_dir;
 	if (drive_through) {
@@ -141,8 +140,8 @@
 
 /* static */ bool AIRoad::RemoveRoad(TileIndex start, TileIndex end)
 {
-	/* Outside of the map */
-	if (start >= ::MapSize() || end >= ::MapSize()) return false;
+	if (!::IsValidTile(start)) return false;
+	if (!::IsValidTile(end)) return false;
 	/* Not on one line */
 	if (TileX(start) != TileX(end) &&
 			TileY(start) != TileY(end)) return false;
@@ -152,8 +151,8 @@
 
 /* static */ bool AIRoad::RemoveRoadFull(TileIndex start, TileIndex end)
 {
-	/* Outside of the map */
-	if (start >= ::MapSize() || end >= ::MapSize()) return false;
+	if (!::IsValidTile(start)) return false;
+	if (!::IsValidTile(end)) return false;
 	/* Not on one line */
 	if (TileX(start) != TileX(end) &&
 			TileY(start) != TileY(end)) return false;
@@ -163,10 +162,7 @@
 
 /* static */ bool AIRoad::RemoveRoadDepot(TileIndex tile)
 {
-	/* Outside of the map */
-	if (tile >= ::MapSize()) return false;
-
-	/* Not a road depot tile */
+	if (!::IsValidTile(tile)) return false;
 	if (!IsTileType(tile, MP_ROAD) || GetRoadTileType(tile) != ROAD_TILE_DEPOT) return false;
 
 	return AIObject::DoCommand(tile, 0, 0, CMD_LANDSCAPE_CLEAR);
@@ -174,10 +170,7 @@
 
 /* static */ bool AIRoad::RemoveRoadStation(TileIndex tile)
 {
-	/* Outside of the map */
-	if (tile >= ::MapSize()) return false;
-
-	/* Not a road station tile */
+	if (!::IsValidTile(tile)) return false;
 	if (!IsTileType(tile, MP_STATION) || !IsRoadStop(tile)) return false;
 
 	return AIObject::DoCommand(tile, 0, GetRoadStopType(tile), CMD_REMOVE_ROAD_STOP);
--- a/src/ai/api/ai_road.hpp	Thu Feb 28 00:43:30 2008 +0000
+++ b/src/ai/api/ai_road.hpp	Thu Feb 28 00:59:01 2008 +0000
@@ -22,7 +22,7 @@
 	 * can be used to traverse a tile. This excludes road depots and
 	 * 'normal' road stations, but includes drive through stations.
 	 * @param tile the tile to check.
-	 * @pre tile is always positive and smaller than AIMap::GetMapSize().
+	 * @pre AIMap::IsValidTile(tile).
 	 * @return true if and only if the tile has road.
 	 */
 	static bool IsRoadTile(TileIndex tile);
@@ -30,7 +30,7 @@
 	/**
 	 * Checks whether the given tile is actually a tile with a road depot.
 	 * @param tile the tile to check.
-	 * @pre tile is always positive and smaller than AIMap::GetMapSize().
+	 * @pre AIMap::IsValidTile(tile).
 	 * @return true if and only if the tile has a road depot.
 	 */
 	static bool IsRoadDepotTile(TileIndex tile);
@@ -38,7 +38,7 @@
 	/**
 	 * Checks whether the given tile is actually a tile with a road station.
 	 * @param tile the tile to check.
-	 * @pre tile is always positive and smaller than AIMap::GetMapSize().
+	 * @pre AIMap::IsValidTile(tile).
 	 * @return true if and only if the tile has a road station.
 	 */
 	static bool IsRoadStationTile(TileIndex tile);
@@ -47,7 +47,7 @@
 	 * Checks whether the given tile is actually a tile with a drive through
 	 * road station.
 	 * @param tile the tile to check.
-	 * @pre tile is always positive and smaller than AIMap::GetMapSize().
+	 * @pre AIMap::IsValidTile(tile).
 	 * @return true if and only if the tile has a drive through road station.
 	 */
 	static bool IsDriveThroughRoadStationTile(TileIndex tile);
@@ -58,8 +58,8 @@
 	 * center of the second tile.
 	 * @param t1 the source tile.
 	 * @param t2 the destination tile.
-	 * @pre t1 is always positive and smaller than AIMap::GetMapSize().
-	 * @pre t2 is always positive and smaller than AIMap::GetMapSize().
+	 * @pre AIMap::IsValidTile(t1).
+	 * @pre AIMap::IsValidTile(t2).
 	 * @pre t1 and t2 are directly neighbouring tiles.
 	 * @return true if and only if a road vehicle can go from t1 to t2.
 	 */
@@ -67,8 +67,8 @@
 
 	/**
 	 * Count how many neighbours are road.
-	 * @pre tile is always positive and smaller than AIMap::GetMapSize().
 	 * @param tile the tile to check on.
+	 * @pre AIMap::IsValidTile(tile).
 	 * @return 0 means no neighbour road; max value is 4.
 	 */
 	static int32 GetNeighbourRoadCount(TileIndex tile);
@@ -105,8 +105,8 @@
 	 * @param start the start tile of the road.
 	 * @param end   the end tile of the road.
 	 * @pre start is not equal to end
-	 * @pre start is always positive and smaller than AIMap::GetMapSize().
-	 * @pre end is always positive and smaller than AIMap::GetMapSize().
+	 * @pre AIMap::IsValidTile(start).
+	 * @pre AIMap::IsValidTile(end).
 	 * @pre start and end are in a straight line, i.e.
 	 *  AIMap::GetTileX(start) == AIMap::GetTileX(end) or
 	 *  AIMap::GetTileY(start) == AIMap::GetTileY(end).
@@ -120,8 +120,8 @@
 	 * @param start the start tile of the road.
 	 * @param end   the end tile of the road.
 	 * @pre start is not equal to end
-	 * @pre start is always positive and smaller than AIMap::GetMapSize().
-	 * @pre end is always positive and smaller than AIMap::GetMapSize().
+	 * @pre AIMap::IsValidTile(start).
+	 * @pre AIMap::IsValidTile(end).
 	 * @pre start and end are in a straight line, i.e.
 	 *  AIMap::GetTileX(start) == AIMap::GetTileX(end) or
 	 *  AIMap::GetTileY(start) == AIMap::GetTileY(end).
@@ -133,8 +133,8 @@
 	 * Builds a road depot.
 	 * @param tile  place to build the depot.
 	 * @param front the tile exactly in front of the depot
-	 * @pre tile is always positive and smaller than AIMap::GetMapSize().
-	 * @pre front is always positive and smaller than AIMap::GetMapSize().
+	 * @pre AIMap::IsValidTile(tile).
+	 * @pre AIMap::IsValidTile(front).
 	 * @pre tile is not equal to front
 	 * @return whether the road depot has been/can be build or not.
 	 */
@@ -147,8 +147,8 @@
 	 *   For drive-through stations either entrance side can be used.
 	 * @param truck whether to build a truck (true) or bus (false) station.
 	 * @param drive_through whether to make the station drive through or not.
-	 * @pre tile is always positive and smaller than AIMap::GetMapSize().
-	 * @pre front is always positive and smaller than AIMap::GetMapSize().
+	 * @pre AIMap::IsValidTile(tile).
+	 * @pre AIMap::IsValidTile(front).
 	 * @pre tile is not equal to front
 	 * @return whether the station has been/can be build or not.
 	 */
@@ -159,8 +159,8 @@
 	 * center of tile end.
 	 * @param start the start tile of the road.
 	 * @param end   the end tile of the road.
-	 * @pre start is always positive and smaller than AIMap::GetMapSize().
-	 * @pre end is always positive and smaller than AIMap::GetMapSize().
+	 * @pre AIMap::IsValidTile(start).
+	 * @pre AIMap::IsValidTile(end).
 	 * @pre start and end are in a straight line, i.e.
 	 *  AIMap::GetTileX(start) == AIMap::GetTileX(end) or
 	 *  AIMap::GetTileY(start) == AIMap::GetTileY(end).
@@ -173,8 +173,8 @@
 	 * edge of tile end (both included).
 	 * @param start the start tile of the road.
 	 * @param end   the end tile of the road.
-	 * @pre start is always positive and smaller than AIMap::GetMapSize().
-	 * @pre end is always positive and smaller than AIMap::GetMapSize().
+	 * @pre AIMap::IsValidTile(start).
+	 * @pre AIMap::IsValidTile(end).
 	 * @pre start and end are in a straight line, i.e.
 	 *  AIMap::GetTileX(start) == AIMap::GetTileX(end) or
 	 *  AIMap::GetTileY(start) == AIMap::GetTileY(end).
@@ -185,7 +185,7 @@
 	/**
 	 * Removes a road depot.
 	 * @param tile place to remove the depot from.
-	 * @pre tile is always positive and smaller than AIMap::GetMapSize().
+	 * @pre AIMap::IsValidTile(tile).
 	 * @pre tile is a road depot.
 	 * @return whether the road depot has been/can be removed or not.
 	 */
@@ -194,7 +194,7 @@
 	/**
 	 * Removes a road bus or truck station.
 	 * @param tile place to remove the station from.
-	 * @pre tile is always positive and smaller than AIMap::GetMapSize().
+	 * @pre AIMap::IsValidTile(tile).
 	 * @pre tile is a road station.
 	 * @return whether the station has been/can be removed or not.
 	 */
--- a/src/ai/api/ai_sign.hpp	Thu Feb 28 00:43:30 2008 +0000
+++ b/src/ai/api/ai_sign.hpp	Thu Feb 28 00:59:01 2008 +0000
@@ -53,7 +53,7 @@
 	 * @param sign_id the sign to get the location of.
 	 * @pre sign_id has to be valid (use IsValidSign()).
 	 * @return the location of the sign.
-	 * @post return value is always positive and below AIMap::GetMapSize().
+	 * @post return value is always valid with AIMap::IsValidTile().
 	 */
 	static TileIndex GetLocation(SignID sign_id);
 
@@ -69,7 +69,7 @@
 	 * Builds a sign on the map.
 	 * @param location the place to build the sign.
 	 * @param text     the text to place on the sign.
-	 * @pre location is always positive and below AIMap::GetMapSize()
+	 * @pre AIMap::IsValidTile(location).
 	 * @pre text is not NULL and non-empty, i.e. length is positive.
 	 * @return the SignID of the build sign (use IsValidSign() to check for validity).
 	 *   In test-mode it returns 0 if successful, or any other value to indicate
--- a/src/ai/api/ai_tile.cpp	Thu Feb 28 00:43:30 2008 +0000
+++ b/src/ai/api/ai_tile.cpp	Thu Feb 28 00:59:01 2008 +0000
@@ -13,8 +13,7 @@
 
 /* static */ bool AITile::IsBuildable(TileIndex tile)
 {
-	/* Outside of the map */
-	if (tile >= ::MapSize()) return false;
+	if (!::IsValidTile(tile)) return false;
 
 	switch (::GetTileType(tile)) {
 		default: return true;
@@ -34,32 +33,28 @@
 
 /* static */ bool AITile::IsWater(TileIndex tile)
 {
-	/* Outside of the map */
-	if (tile >= ::MapSize()) return false;
+	if (!::IsValidTile(tile)) return false;
 
 	return ::GetTileType(tile) == MP_WATER;
 }
 
 /* static */ int32 AITile::GetSlope(TileIndex tile)
 {
-	/* Outside of the map */
-	if (tile >= ::MapSize()) return 0;
+	if (!::IsValidTile(tile)) return false;
 
 	return ::GetTileSlope(tile, NULL);
 }
 
 /* static */ int32 AITile::GetHeight(TileIndex tile)
 {
-	/* Outside of the map */
-	if (tile >= ::MapSize()) return 0;
+	if (!::IsValidTile(tile)) return false;
 
 	return ::TileHeight(tile);
 }
 
 /* static */ int32 AITile::GetCargoAcceptance(TileIndex tile, CargoID cargo_type, uint width, uint height, uint radius)
 {
-	/* Outside of the map */
-	if (tile >= ::MapSize()) return 0;
+	if (!::IsValidTile(tile)) return false;
 
 	AcceptedCargo accepts;
 	::GetAcceptanceAroundTiles(accepts, tile, width, height, _patches.modified_catchment ? radius : (uint)CA_UNMODIFIED);
@@ -68,8 +63,7 @@
 
 /* static */ int32 AITile::GetCargoProduction(TileIndex tile, CargoID cargo_type, uint width, uint height, uint radius)
 {
-	/* Outside of the map */
-	if (tile >= ::MapSize()) return 0;
+	if (!::IsValidTile(tile)) return false;
 
 	AcceptedCargo produced;
 	::GetProductionAroundTiles(produced, tile, width, height, _patches.modified_catchment ? radius : (uint)CA_UNMODIFIED);
@@ -78,16 +72,14 @@
 
 /* static */ bool AITile::RaiseTile(TileIndex tile, int32 slope)
 {
-	/* Outside of the map */
-	if (tile >= ::MapSize()) return false;
+	if (!::IsValidTile(tile)) return false;
 
 	return AIObject::DoCommand(tile, slope, 1, CMD_TERRAFORM_LAND);
 }
 
 /* static */ bool AITile::LowerTile(TileIndex tile, int32 slope)
 {
-	/* Outside of the map */
-	if (tile >= ::MapSize()) return false;
+	if (!::IsValidTile(tile)) return false;
 
 	return AIObject::DoCommand(tile, slope, 0, CMD_TERRAFORM_LAND);
 }
--- a/src/ai/api/ai_tile.hpp	Thu Feb 28 00:43:30 2008 +0000
+++ b/src/ai/api/ai_tile.hpp	Thu Feb 28 00:59:01 2008 +0000
@@ -52,32 +52,32 @@
 	/**
 	 * Check if this tile is buildable (e.g.: no things on it that needs removing).
 	 * @note Road and rail are considered buildable.
-	 * @pre tile is always positive and smaller than AIMap::GetMapSize().
 	 * @param tile the tile to check on.
+	 * @pre AIMap::IsValidTile(tile).
 	 * @return true if it is buildable, false if not.
 	 */
 	static bool IsBuildable(TileIndex tile);
 
 	/**
 	 * Check if a tile is water.
-	 * @pre tile is always positive and smaller than AIMap::GetMapSize().
 	 * @param tile the tile to check on.
+	 * @pre AIMap::IsValidTile(tile).
 	 * @return true if it is water, false if not.
 	 */
 	static bool IsWater(TileIndex tile);
 
 	/**
 	 * Get the slope of a tile.
-	 * @pre tile is always positive and smaller than AIMap::GetMapSize().
 	 * @param tile the tile to check on.
+	 * @pre AIMap::IsValidTile(tile).
 	 * @return 0 means flat, others indicate internal state of slope.
 	 */
 	static int32 GetSlope(TileIndex tile);
 
 	/**
 	 * Get the height of the tile.
-	 * @pre tile is always positive and smaller than AIMap::GetMapSize().
 	 * @param tile the tile to check on.
+	 * @pre AIMap::IsValidTile(tile).
 	 * @return the height of the tile, ranging from 0 to 15.
 	 */
 	static int32 GetHeight(TileIndex tile);
@@ -86,12 +86,12 @@
 	 * Check how much cargo this tile accepts.
 	 *  It creates a radius around the tile, and adds up all acceptance of this
 	 *   cargo.
-	 * @pre tile is always positive and smaller than AIMap::GetMapSize().
 	 * @param tile the tile to check on.
 	 * @param cargo_type the cargo to check the acceptance of.
 	 * @param width the width of the station.
 	 * @param height the height of the station.
 	 * @param radius the radius of the station.
+	 * @pre AIMap::IsValidTile(tile).
 	 * @return value below 8 means no acceptance; the more the better.
 	 */
 	static int32 GetCargoAcceptance(TileIndex tile, CargoID cargo_type, uint width, uint height, uint radius);
@@ -100,12 +100,12 @@
 	 * Checks how many tiles in the radius produces this cargo.
 	 *  It creates a radius around the tile, and adds up all tiles that produce
 	 *  this cargo.
-	 * @pre tile is always positive and smaller than AIMap::GetMapSize().
 	 * @param tile the tile to check on.
 	 * @param cargo_type the cargo to check the production of.
 	 * @param width the width of the station.
 	 * @param height the height of the station.
 	 * @param radius the radius of the station.
+	 * @pre AIMap::IsValidTile(tile).
 	 * @return the tiles that produce this cargo within radius of the tile.
 	 * @note town(houses) are not included in the value.
 	 */
@@ -114,9 +114,9 @@
 	/**
 	 * Raise the given corners of the tile. The corners can be combined,
 	 *  for example: SLOPE_N | SLOPE_W (= SLOPE_NW)
-	 * @pre tile is always positive and smaller than AIMap::GetMapSize().
 	 * @param tile the tile to raise.
 	 * @param slope corners to raise (SLOPE_xxx).
+	 * @pre AIMap::IsValidTile(tile).
 	 * @return 0 means failed, 1 means success.
 	 */
 	static bool RaiseTile(TileIndex tile, int32 slope);
@@ -124,9 +124,9 @@
 	/**
 	 * Lower the given corners of the tile. The corners can be combined,
 	 *  for example: SLOPE_N | SLOPE_W (= SLOPE_NW)
-	 * @pre tile is always positive and smaller than AIMap::GetMapSize().
 	 * @param tile the tile to lower.
 	 * @param slope corners to lower (SLOPE_xxx).
+	 * @pre AIMap::IsValidTile(tile).
 	 * @return 0 means failed, 1 means success.
 	 */
 	static bool LowerTile(TileIndex tile, int32 slope);
--- a/src/ai/api/ai_tilelist.cpp	Thu Feb 28 00:43:30 2008 +0000
+++ b/src/ai/api/ai_tilelist.cpp	Thu Feb 28 00:59:01 2008 +0000
@@ -29,7 +29,8 @@
 
 void AITileList::AddRectangle(TileIndex t1, TileIndex t2)
 {
-	if (!IsValidTile(t1) || !IsValidTile(t2)) return;
+	if (!::IsValidTile(t1)) return;
+	if (!::IsValidTile(t2)) return;
 
 	this->FixRectangleSpan(t1, t2);
 
@@ -43,14 +44,15 @@
 
 void AITileList::AddTile(TileIndex tile)
 {
-	if (!IsValidTile(tile)) return;
+	if (!::IsValidTile(tile)) return;
 
 	this->AddItem(tile);
 }
 
 void AITileList::RemoveRectangle(TileIndex t1, TileIndex t2)
 {
-	if (!IsValidTile(t1) || !IsValidTile(t2)) return;
+	if (!::IsValidTile(t1)) return;
+	if (!::IsValidTile(t2)) return;
 
 	this->FixRectangleSpan(t1, t2);
 
@@ -64,7 +66,7 @@
 
 void AITileList::RemoveTile(TileIndex tile)
 {
-	if (!IsValidTile(tile)) return;
+	if (!::IsValidTile(tile)) return;
 
 	this->RemoveItem(tile);
 }
--- a/src/ai/api/ai_tilelist.hpp	Thu Feb 28 00:43:30 2008 +0000
+++ b/src/ai/api/ai_tilelist.hpp	Thu Feb 28 00:59:01 2008 +0000
@@ -34,15 +34,15 @@
 	 * Adds the rectangle between tile_from and tile_to to the to-be-evaluated tiles.
 	 * @param tile_from one corner of the tiles to add.
 	 * @param tile_to the other corner of the tiles to add.
-	 * @pre tile_from is below AIMap::GetMapSize().
-	 * @pre tile_to is below AIMap::GetMapSize().
+	 * @pre AIMap::IsValidTile(tile_from).
+	 * @pre AIMap::IsValidTile(tile_to).
 	 */
 	void AddRectangle(TileIndex tile_from, TileIndex tile_to);
 
 	/**
 	 * Add a tile to the to-be-evaluated tiles.
 	 * @param tile the tile to add.
-	 * @pre tile is below AIMap::GetMapSize().
+	 * @pre AIMap::IsValidTile(tile).
 	 */
 	void AddTile(TileIndex tile);
 
@@ -50,15 +50,15 @@
 	 * Remove the tiles inside the rectangle between tile_from and tile_to form the list.
 	 * @param tile_from one corner of the tiles to remove.
 	 * @param tile_to the other corner of the files to remove.
-	 * @pre tile_from is below AIMap::GetMapSize().
-	 * @pre tile_to is below AIMap::GetMapSize().
+	 * @pre AIMap::IsValidTile(tile_from).
+	 * @pre AIMap::IsValidTile(tile_to).
 	 */
 	void RemoveRectangle(TileIndex tile_from, TileIndex tile_to);
 
 	/**
 	 * Remove a tile from the list.
 	 * @param tile the tile to remove.
-	 * @pre tile is below AIMap::GetMapSize().
+	 * @pre AIMap::IsValidTile(tile).
 	 */
 	void RemoveTile(TileIndex tile);
 };
--- a/src/ai/api/ai_town.hpp	Thu Feb 28 00:43:30 2008 +0000
+++ b/src/ai/api/ai_town.hpp	Thu Feb 28 00:59:01 2008 +0000
@@ -63,7 +63,7 @@
 	 * @param town_id the location of the town.
 	 * @pre town_id has to be valid (use IsValidTown()).
 	 * @return the location of the town.
-	 * @post return value is always positive and below AIMap::GetMapSize().
+	 * @post return value is always valid with AIMap::IsValidTile().
 	 */
 	static TileIndex GetLocation(TownID town_id);
 };
--- a/src/ai/api/ai_tunnel.hpp	Thu Feb 28 00:43:30 2008 +0000
+++ b/src/ai/api/ai_tunnel.hpp	Thu Feb 28 00:59:01 2008 +0000
@@ -18,7 +18,7 @@
 
 	/**
 	 * Check wether the tile is an entrance to a tunnel.
-	 * @pre tile is always positive and smaller than AIMap::GetMapSize().
+	 * @pre AIMap::IsValidTile(tile).
 	 * @param tile The tile to check.
 	 * @note true if and only if the tile is the beginning or end of a tunnel.
 	 */
@@ -26,7 +26,7 @@
 
 	/**
 	 * Get the tile that exits on the other end of a tunnel starting at tunnelTile.
-	 * @pre tile is always positive and smaller than AIMap::GetMapSize() and tunnel entrance must be located on that tile.
+	 * @pre AIMap::IsValidTile(tile) && IsTunnelTile(tile).
 	 * @param tile A tile that is an entrance to a tunnel.
 	 * @return The TileIndex that is the other end of the tunnel.
 	 */
@@ -38,7 +38,7 @@
 	 *  rails or roads; use the appropriate AIVehicle::VehicleType.
 	 * @param start Where to start the tunnel.
 	 * @param vehicle_type The vehicle-type of tunnel to build.
-	 * @pre start is always positive and smaller than AIMap::GetMapSize().
+	 * @pre AIMap::IsValidTile(start).
 	 * @pre vehicle_type is either AIVehicle::VEHICLE_RAIL or AIVEHICLE::VEHICLE_ROAD.
 	 * @return Whether the tunnel has been/can be build or not.
 	 * @note The slope of a tile can be determined by AITile::GetSlope(TileIndex).
@@ -47,8 +47,8 @@
 
 	/**
 	 * Remove the tunnel whose entrance is located at tile.
-	 * @pre tile is always positive and smaller than AIMap::GetMapSize().
 	 * @param tile a tile that is an entrance to a tunnel.
+	 * @pre AIMap::IsValidTile(tile) && IsTunnelTile(tile).
 	 * @return Whether the tunnel has been/can be removed or not.
 	 */
 	static bool RemoveTunnel(TileIndex tile);