src/ai/api/ai_tile.hpp
branchnoai
changeset 10089 e351169bf3a5
parent 9842 ef007135fa47
child 10094 e737405b06dd
--- a/src/ai/api/ai_tile.hpp	Mon Apr 07 18:32:42 2008 +0000
+++ b/src/ai/api/ai_tile.hpp	Mon Apr 07 18:37:23 2008 +0000
@@ -6,6 +6,7 @@
 #define AI_TILE_HPP
 
 #include "ai_abstractlist.hpp"
+#include "ai_error.hpp"
 
 /**
  * Class that handles all tile related functions.
@@ -15,6 +16,24 @@
 	static const char *GetClassName() { return "AITile"; }
 
 	/**
+	 * Error messages related to modifying tiles.
+	 */
+	enum ErrorMessages {
+
+		/** Base for tile related errors */
+		ERR_TILE_BASE = AIError::ERR_CAT_TILE << AIError::ERR_CAT_BIT_SIZE,
+
+		/** Tile can't be raised any higher */
+		ERR_TILE_TOO_HIGH,                     //< [STR_1003_ALREADY_AT_SEA_LEVEL]
+
+		/** Tile can't be lowered any lower */
+		ERR_TILE_TOO_LOW,                      //< [STR_1003_ALREADY_AT_SEA_LEVEL]
+
+		/** Tile can't be raised or lowered because it is to close to the map */
+		ERR_TILE_TOO_CLOSE_TO_EDGE,            //< [STR_0002_TOO_CLOSE_TO_EDGE_OF_MAP]
+	};
+
+	/**
 	 * Enumeration for the slope-type (from slopes.h).
 	 *
 	 * This enumeration use the chars N, E, S, W corresponding the
@@ -142,6 +161,9 @@
 	 * @param tile The tile to raise.
 	 * @param slope Corners to raise (SLOPE_xxx).
 	 * @pre AIMap::IsValidTile(tile).
+	 * @exception AIERROR::ERR_AREA_NOT_CLEAR
+	 * @exception AITILE::ERR_TILE_TOO_HIGH
+	 * @exception AITILE::ERR_TILE_CLOSE_TO_EDGE
 	 * @return 0 means failed, 1 means success.
 	 */
 	static bool RaiseTile(TileIndex tile, int32 slope);
@@ -152,6 +174,9 @@
 	 * @param tile The tile to lower.
 	 * @param slope Corners to lower (SLOPE_xxx).
 	 * @pre AIMap::IsValidTile(tile).
+	 * @exception AIERROR::ERR_AREA_NOT_CLEAR
+	 * @exception AITILE::ERR_TILE_TOO_LOW
+	 * @exception AITILE::ERR_TILE_CLOSE_TO_EDGE
 	 * @return 0 means failed, 1 means success.
 	 */
 	static bool LowerTile(TileIndex tile, int32 slope);
@@ -160,6 +185,7 @@
 	 * Destroy everything on the given tile.
 	 * @param tile The tile to demolish.
 	 * @pre AIMap::IsValidTile(tile).
+	 * @exception AIERROR::ERR_AREA_NOT_CLEAR
 	 * @return True if and only if the tile was demolished.
 	 */
 	static bool DemolishTile(TileIndex tile);