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 SCRIPT_BRIDGE_HPP 00013 #define SCRIPT_BRIDGE_HPP 00014 00015 #include "script_vehicle.hpp" 00016 00021 class ScriptBridge : public ScriptObject { 00022 public: 00026 enum ErrorMessages { 00028 ERR_BRIDGE_BASE = ScriptError::ERR_CAT_BRIDGE << ScriptError::ERR_CAT_BIT_SIZE, 00029 00034 ERR_BRIDGE_TYPE_UNAVAILABLE, // [STR_ERROR_CAN_T_BUILD_BRIDGE_HERE] 00035 00037 ERR_BRIDGE_CANNOT_END_IN_WATER, // [STR_ERROR_ENDS_OF_BRIDGE_MUST_BOTH] 00038 00040 ERR_BRIDGE_HEADS_NOT_ON_SAME_HEIGHT, // [STR_ERROR_BRIDGEHEADS_NOT_SAME_HEIGHT] 00041 }; 00042 00048 static bool IsValidBridge(BridgeID bridge_id); 00049 00056 static bool IsBridgeTile(TileIndex tile); 00057 00064 static BridgeID GetBridgeID(TileIndex tile); 00065 00072 static char *GetName(BridgeID bridge_id); 00073 00083 static int32 GetMaxSpeed(BridgeID bridge_id); 00084 00092 static Money GetPrice(BridgeID bridge_id, uint length); 00093 00100 static int32 GetMaxLength(BridgeID bridge_id); 00101 00108 static int32 GetMinLength(BridgeID bridge_id); 00109 00114 static bool _BuildBridgeRoad1(); 00115 00120 static bool _BuildBridgeRoad2(); 00121 00149 static bool BuildBridge(ScriptVehicle::VehicleType vehicle_type, BridgeID bridge_id, TileIndex start, TileIndex end); 00150 00158 static bool RemoveBridge(TileIndex tile); 00159 00167 static TileIndex GetOtherBridgeEnd(TileIndex tile); 00168 }; 00169 00170 #endif /* SCRIPT_BRIDGE_HPP */