# ai_bridge.hpp

Go to the documentation of this file.

    00001 /* $Id$ */
    00002
    00003 /*
    00004  * This file is part of OpenTTD.
    00005  * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
    00006  * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    00007  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
    00008  */
    00009
    00012 #ifndef AI_BRIDGE_HPP
    00013 #define AI_BRIDGE_HPP
    00014
    00015 #include "ai_vehicle.hpp"
    00016
    00020 class AIBridge : public AIObject {
    00021 public:
    00025   enum ErrorMessages {
    00027     ERR_BRIDGE_BASE = AIError::ERR_CAT_BRIDGE << AIError::ERR_CAT_BIT_SIZE,
    00028
    00033     ERR_BRIDGE_TYPE_UNAVAILABLE,         // [STR_ERROR_CAN_T_BUILD_BRIDGE_HERE]
    00034
    00036     ERR_BRIDGE_CANNOT_END_IN_WATER,      // [STR_ERROR_ENDS_OF_BRIDGE_MUST_BOTH]
    00037
    00039     ERR_BRIDGE_HEADS_NOT_ON_SAME_HEIGHT, // [STR_ERROR_BRIDGEHEADS_NOT_SAME_HEIGHT]
    00040   };
    00041
    00043   static const char *GetClassName() { return "AIBridge"; }
    00044
    00050   static bool IsValidBridge(BridgeID bridge_id);
    00051
    00058   static bool IsBridgeTile(TileIndex tile);
    00059
    00066   static BridgeID GetBridgeID(TileIndex tile);
    00067
    00074   static char *GetName(BridgeID bridge_id);
    00075
    00085   static int32 GetMaxSpeed(BridgeID bridge_id);
    00086
    00094   static Money GetPrice(BridgeID bridge_id, uint length);
    00095
    00102   static int32 GetMaxLength(BridgeID bridge_id);
    00103
    00110   static int32 GetMinLength(BridgeID bridge_id);
    00111
    00112 #ifndef DOXYGEN_SKIP
    00113
    00116   static bool _BuildBridgeRoad1();
    00117
    00121   static bool _BuildBridgeRoad2();
    00122 #endif
    00123
    00151   static bool BuildBridge(AIVehicle::VehicleType vehicle_type, BridgeID bridge_id, TileIndex start, TileIndex end);
    00152
    00160   static bool RemoveBridge(TileIndex tile);
    00161
    00169   static TileIndex GetOtherBridgeEnd(TileIndex tile);
    00170 };
    00171
    00172 #endif /* AI_BRIDGE_HPP */