00001 /* $Id: ai_bridge.hpp 20288 2010-08-01 20:41:46Z yexo $ */ 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 00045 static const char *GetClassName() { return "AIBridge"; } 00046 00052 static bool IsValidBridge(BridgeID bridge_id); 00053 00060 static bool IsBridgeTile(TileIndex tile); 00061 00068 static BridgeID GetBridgeID(TileIndex tile); 00069 00076 static char *GetName(BridgeID bridge_id); 00077 00087 static int32 GetMaxSpeed(BridgeID bridge_id); 00088 00096 static Money GetPrice(BridgeID bridge_id, uint length); 00097 00104 static int32 GetMaxLength(BridgeID bridge_id); 00105 00112 static int32 GetMinLength(BridgeID bridge_id); 00113 00114 #ifndef DOXYGEN_SKIP 00115 00118 static bool _BuildBridgeRoad1(); 00119 00123 static bool _BuildBridgeRoad2(); 00124 #endif 00125 00153 static bool BuildBridge(AIVehicle::VehicleType vehicle_type, BridgeID bridge_id, TileIndex start, TileIndex end); 00154 00162 static bool RemoveBridge(TileIndex tile); 00163 00171 static TileIndex GetOtherBridgeEnd(TileIndex tile); 00172 }; 00173 00174 #endif /* AI_BRIDGE_HPP */