--- a/src/ai/api/ai_marine.hpp Tue Apr 08 07:19:02 2008 +0000
+++ b/src/ai/api/ai_marine.hpp Tue Apr 08 07:24:23 2008 +0000
@@ -6,6 +6,7 @@
#define AI_MARINE_HPP
#include "ai_object.hpp"
+#include "ai_error.hpp"
/**
* Class that handles all marine related functions.
@@ -14,6 +15,14 @@
public:
static const char *GetClassName() { return "AIMarine"; }
+ enum ErrorMessages {
+ /** Base for marine related errors */
+ ERR_MARINE_BASE = AIError::ERR_CAT_MARINE << AIError::ERR_CAT_BIT_SIZE,
+
+ /** Infrastructure must be built on water */
+ ERR_MARINE_MUST_BE_BUILT_ON_WATER, // [STR_3801_MUST_BE_BUILT_ON_WATER]
+ };
+
/**
* Checks whether the given tile is actually a tile with a water depot.
* @param tile The tile to check.
@@ -59,6 +68,9 @@
* @param tile The tile where the water depot will be build.
* @param vertical If true, depot will be vertical, else horizontal.
* @pre AIMap::IsValidTile(tile).
+ * @exception AIError::ERR_AREA_NOT_CLEAR
+ * @exception AIError::ERR_SITE_UNSUITABLE
+ * @exception AIMarine::ERR_MARINE_MUST_BE_BUILT_ON_WATER
* @return Whether the water depot has been/can be build or not.
*/
static bool BuildWaterDepot(TileIndex tile, bool vertical);
@@ -67,6 +79,10 @@
* Builds a dock where tile is the tile still on land.
* @param tile The tile still on land of the dock.
* @pre AIMap::IsValidTile(tile).
+ * @exception AIError::ERR_AREA_NOT_CLEAR
+ * @exception AIError::ERR_SITE_UNSUITABLE
+ * @exception AIStation::ERR_STATION_TOO_CLOSE_TO_ANOTHER_STATION
+ * @exception AIStation::ERR_STATION_TOO_MANY_STATIONS
* @return Whether the dock has been/can be build or not.
*/
static bool BuildDock(TileIndex tile);
@@ -75,6 +91,9 @@
* Builds a buoy on tile.
* @param tile The tile where the buoy will be build.
* @pre AIMap::IsValidTile(tile).
+ * @exception AIError::ERR_AREA_NOT_CLEAR
+ * @exception AIError::ERR_SITE_UNSUITABLE
+ * @exception AIStation::ERR_STATION_TOO_MANY_STATIONS
* @return Whether the buoy has been/can be build or not.
*/
static bool BuildBuoy(TileIndex tile);
@@ -83,6 +102,8 @@
* Builds a lock on tile.
* @param tile The tile where the lock will be build.
* @pre AIMap::IsValidTile(tile).
+ * @exception AIError::ERR_LAND_SLOPED_WRONG
+ * @exception AIError::ERR_SITE_UNSUITABLE
* @return Whether the lock has been/can be build or not.
*/
static bool BuildLock(TileIndex tile);
@@ -91,6 +112,10 @@
* Builds a canal on tile.
* @param tile The tile where the canal will be build.
* @pre AIMap::IsValidTile(tile).
+ * @exception AIError::ERR_AREA_NOT_CLEAR
+ * @exception AIError::ERR_LAND_SLOPED_WRONG
+ * @exception AIError::ERR_OWNED_BY_ANOTHER_COMPANY
+ * @exception AIError::ERR_ALREADY_BUILT
* @return Whether the canal has been/can be build or not.
*/
static bool BuildCanal(TileIndex tile);
@@ -99,6 +124,7 @@
* Removes a water depot.
* @param tile Any tile of the water depot.
* @pre AIMap::IsValidTile(tile).
+ * @exception AIError::ERR_OWNED_BY_ANOTHER_COMPANY
* @return Whether the water depot has been/can be removed or not.
*/
static bool RemoveWaterDepot(TileIndex tile);
@@ -107,6 +133,7 @@
* Removes a dock.
* @param tile Any tile of the dock.
* @pre AIMap::IsValidTile(tile).
+ * @exception AIError::ERR_OWNED_BY_ANOTHER_COMPANY
* @return Whether the dock has been/can be removed or not.
*/
static bool RemoveDock(TileIndex tile);
@@ -115,6 +142,7 @@
* Removes a buoy.
* @param tile Any tile of the buoy.
* @pre AIMap::IsValidTile(tile).
+ * @exception AIError::ERR_OWNED_BY_ANOTHER_COMPANY
* @return Whether the buoy has been/can be removed or not.
*/
static bool RemoveBuoy(TileIndex tile);
@@ -123,6 +151,7 @@
* Removes a lock.
* @param tile Any tile of the lock.
* @pre AIMap::IsValidTile(tile).
+ * @exception AIError::ERR_OWNED_BY_ANOTHER_COMPANY
* @return Whether the lock has been/can be removed or not.
*/
static bool RemoveLock(TileIndex tile);
@@ -131,6 +160,7 @@
* Removes a canal.
* @param tile Any tile of the canal.
* @pre AIMap::IsValidTile(tile).
+ * @exception AIError::ERR_OWNED_BY_ANOTHER_COMPANY
* @return Whether the canal has been/can be removed or not.
*/
static bool RemoveCanal(TileIndex tile);