truelight@9691: /* $Id$ */ truelight@9691: truebrain@9829: /** @file ai_marine.hpp Everything to query and build marine. */ truelight@9691: truelight@9691: #ifndef AI_MARINE_HPP truelight@9691: #define AI_MARINE_HPP truelight@9691: truelight@9691: #include "ai_object.hpp" rubidium@10094: #include "ai_error.hpp" truelight@9691: truelight@9691: /** truelight@9691: * Class that handles all marine related functions. truelight@9691: */ truelight@9691: class AIMarine : public AIObject { truelight@9691: public: truelight@9691: static const char *GetClassName() { return "AIMarine"; } truelight@9691: truebrain@10096: /** truebrain@10096: * All marine related error messages. truebrain@10096: */ rubidium@10094: enum ErrorMessages { rubidium@10094: /** Base for marine related errors */ rubidium@10094: ERR_MARINE_BASE = AIError::ERR_CAT_MARINE << AIError::ERR_CAT_BIT_SIZE, rubidium@10094: rubidium@10094: /** Infrastructure must be built on water */ rubidium@10094: ERR_MARINE_MUST_BE_BUILT_ON_WATER, // [STR_3801_MUST_BE_BUILT_ON_WATER] rubidium@10094: }; rubidium@10094: truelight@9691: /** truelight@9691: * Checks whether the given tile is actually a tile with a water depot. truebrain@9836: * @param tile The tile to check. truebrain@9801: * @pre AIMap::IsValidTile(tile). truebrain@9836: * @return True if and only if the tile has a water depot. truelight@9691: */ truelight@9691: static bool IsWaterDepotTile(TileIndex tile); truelight@9691: truelight@9691: /** truelight@9691: * Checks whether the given tile is actually a tile with a dock. truebrain@9836: * @param tile The tile to check. truebrain@9801: * @pre AIMap::IsValidTile(tile). truebrain@9836: * @return True if and only if the tile has a dock. truelight@9691: */ truelight@9691: static bool IsDockTile(TileIndex tile); truelight@9691: truelight@9691: /** truelight@9691: * Checks whether the given tile is actually a tile with a buoy. truebrain@9836: * @param tile The tile to check. truebrain@9801: * @pre AIMap::IsValidTile(tile). truebrain@9836: * @return True if and only if the tile has a buoy. truelight@9691: */ truelight@9691: static bool IsBuoyTile(TileIndex tile); truelight@9691: truelight@9691: /** truelight@9691: * Checks whether the given tile is actually a tile with a lock. truebrain@9836: * @param tile The tile to check. truebrain@9801: * @pre AIMap::IsValidTile(tile). truebrain@9836: * @return True if and only if the tile has a lock. truelight@9691: */ truelight@9691: static bool IsLockTile(TileIndex tile); truelight@9691: truelight@9691: /** truelight@9691: * Checks whether the given tile is actually a tile with a canal. truebrain@9836: * @param tile The tile to check. truebrain@9801: * @pre AIMap::IsValidTile(tile). truebrain@9836: * @return True if and only if the tile has a canal. truelight@9691: */ truelight@9691: static bool IsCanalTile(TileIndex tile); truelight@9691: truelight@9691: /** truelight@9691: * Builds a water depot on tile. truebrain@9836: * @param tile The tile where the water depot will be build. truebrain@9836: * @param vertical If true, depot will be vertical, else horizontal. truebrain@9801: * @pre AIMap::IsValidTile(tile). rubidium@10094: * @exception AIError::ERR_AREA_NOT_CLEAR rubidium@10094: * @exception AIError::ERR_SITE_UNSUITABLE rubidium@10094: * @exception AIMarine::ERR_MARINE_MUST_BE_BUILT_ON_WATER truebrain@9836: * @return Whether the water depot has been/can be build or not. truelight@9691: */ truebrain@9737: static bool BuildWaterDepot(TileIndex tile, bool vertical); truelight@9691: truelight@9691: /** truelight@9691: * Builds a dock where tile is the tile still on land. truebrain@9836: * @param tile The tile still on land of the dock. truebrain@9801: * @pre AIMap::IsValidTile(tile). rubidium@10094: * @exception AIError::ERR_AREA_NOT_CLEAR rubidium@10094: * @exception AIError::ERR_SITE_UNSUITABLE rubidium@10094: * @exception AIStation::ERR_STATION_TOO_CLOSE_TO_ANOTHER_STATION rubidium@10094: * @exception AIStation::ERR_STATION_TOO_MANY_STATIONS truebrain@9836: * @return Whether the dock has been/can be build or not. truelight@9691: */ truebrain@9737: static bool BuildDock(TileIndex tile); truelight@9691: truelight@9691: /** truelight@9691: * Builds a buoy on tile. truebrain@9836: * @param tile The tile where the buoy will be build. truebrain@9801: * @pre AIMap::IsValidTile(tile). rubidium@10094: * @exception AIError::ERR_AREA_NOT_CLEAR rubidium@10094: * @exception AIError::ERR_SITE_UNSUITABLE rubidium@10094: * @exception AIStation::ERR_STATION_TOO_MANY_STATIONS truebrain@9836: * @return Whether the buoy has been/can be build or not. truelight@9691: */ truebrain@9737: static bool BuildBuoy(TileIndex tile); truelight@9691: truelight@9691: /** truelight@9691: * Builds a lock on tile. truebrain@9836: * @param tile The tile where the lock will be build. truebrain@9801: * @pre AIMap::IsValidTile(tile). rubidium@10094: * @exception AIError::ERR_LAND_SLOPED_WRONG rubidium@10094: * @exception AIError::ERR_SITE_UNSUITABLE truebrain@9836: * @return Whether the lock has been/can be build or not. truelight@9691: */ truebrain@9737: static bool BuildLock(TileIndex tile); truelight@9691: truelight@9691: /** truelight@9691: * Builds a canal on tile. truebrain@9836: * @param tile The tile where the canal will be build. truebrain@9801: * @pre AIMap::IsValidTile(tile). rubidium@10094: * @exception AIError::ERR_AREA_NOT_CLEAR rubidium@10094: * @exception AIError::ERR_LAND_SLOPED_WRONG rubidium@10094: * @exception AIError::ERR_OWNED_BY_ANOTHER_COMPANY rubidium@10094: * @exception AIError::ERR_ALREADY_BUILT truebrain@9836: * @return Whether the canal has been/can be build or not. truelight@9691: */ truebrain@9737: static bool BuildCanal(TileIndex tile); truelight@9691: truelight@9691: /** truelight@9691: * Removes a water depot. truebrain@9836: * @param tile Any tile of the water depot. truebrain@9801: * @pre AIMap::IsValidTile(tile). rubidium@10094: * @exception AIError::ERR_OWNED_BY_ANOTHER_COMPANY truebrain@9836: * @return Whether the water depot has been/can be removed or not. truelight@9691: */ truebrain@9737: static bool RemoveWaterDepot(TileIndex tile); truelight@9691: truelight@9691: /** truelight@9691: * Removes a dock. truebrain@9836: * @param tile Any tile of the dock. truebrain@9801: * @pre AIMap::IsValidTile(tile). rubidium@10094: * @exception AIError::ERR_OWNED_BY_ANOTHER_COMPANY truebrain@9836: * @return Whether the dock has been/can be removed or not. truelight@9691: */ truebrain@9737: static bool RemoveDock(TileIndex tile); truelight@9691: truelight@9691: /** truelight@9691: * Removes a buoy. truebrain@9836: * @param tile Any tile of the buoy. truebrain@9801: * @pre AIMap::IsValidTile(tile). rubidium@10094: * @exception AIError::ERR_OWNED_BY_ANOTHER_COMPANY truebrain@9836: * @return Whether the buoy has been/can be removed or not. truelight@9691: */ truebrain@9737: static bool RemoveBuoy(TileIndex tile); truelight@9691: truelight@9691: /** truelight@9691: * Removes a lock. truebrain@9836: * @param tile Any tile of the lock. truebrain@9801: * @pre AIMap::IsValidTile(tile). rubidium@10094: * @exception AIError::ERR_OWNED_BY_ANOTHER_COMPANY truebrain@9836: * @return Whether the lock has been/can be removed or not. truelight@9691: */ truebrain@9737: static bool RemoveLock(TileIndex tile); truelight@9691: truelight@9691: /** truelight@9691: * Removes a canal. truebrain@9836: * @param tile Any tile of the canal. truebrain@9801: * @pre AIMap::IsValidTile(tile). rubidium@10094: * @exception AIError::ERR_OWNED_BY_ANOTHER_COMPANY truebrain@9836: * @return Whether the canal has been/can be removed or not. truelight@9691: */ truebrain@9737: static bool RemoveCanal(TileIndex tile); truelight@9691: }; truelight@9691: truelight@9691: #endif /* AI_MARINE_HPP */