# ai_bridge.hpp

Go to the documentation of this file.

    00001 /* $Id: ai_bridge.hpp 19928 2010-06-04 21:14:22Z rubidium $ */
    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_object.hpp"
    00016 #include "ai_vehicle.hpp"
    00017 #include "ai_error.hpp"
    00018
    00022 class AIBridge : public AIObject {
    00023 public:
    00027   enum ErrorMessages {
    00029     ERR_BRIDGE_BASE = AIError::ERR_CAT_BRIDGE << AIError::ERR_CAT_BIT_SIZE,
    00030
    00035     ERR_BRIDGE_TYPE_UNAVAILABLE,         // [STR_ERROR_CAN_T_BUILD_BRIDGE_HERE]
    00036
    00038     ERR_BRIDGE_CANNOT_END_IN_WATER,      // [STR_ERROR_ENDS_OF_BRIDGE_MUST_BOTH]
    00039
    00041     ERR_BRIDGE_HEADS_NOT_ON_SAME_HEIGHT, // [STR_ERROR_BRIDGEHEADS_NOT_SAME_HEIGHT]
    00042   };
    00043
    00044   static const char *GetClassName() { return "AIBridge"; }
    00045
    00051   static bool IsValidBridge(BridgeID bridge_id);
    00052
    00059   static bool IsBridgeTile(TileIndex tile);
    00060
    00067   static BridgeID GetBridgeID(TileIndex tile);
    00068
    00075   static char *GetName(BridgeID bridge_id);
    00076
    00086   static int32 GetMaxSpeed(BridgeID bridge_id);
    00087
    00095   static Money GetPrice(BridgeID bridge_id, uint length);
    00096
    00103   static int32 GetMaxLength(BridgeID bridge_id);
    00104
    00111   static int32 GetMinLength(BridgeID bridge_id);
    00112
    00113 #ifndef DOXYGEN_SKIP
    00114
    00117   static bool _BuildBridgeRoad1();
    00118
    00122   static bool _BuildBridgeRoad2();
    00123 #endif
    00124
    00152   static bool BuildBridge(AIVehicle::VehicleType vehicle_type, BridgeID bridge_id, TileIndex start, TileIndex end);
    00153
    00161   static bool RemoveBridge(TileIndex tile);
    00162
    00170   static TileIndex GetOtherBridgeEnd(TileIndex tile);
    00171 };
    00172
    00173 #endif /* AI_BRIDGE_HPP */