Class that handles all bridge related functions. More...
#include <ai_bridge.hpp>
Public Types | |
| enum | ErrorMessages { ERR_BRIDGE_BASE = AIError::ERR_CAT_BRIDGE << AIError::ERR_CAT_BIT_SIZE, ERR_BRIDGE_TYPE_UNAVAILABLE, ERR_BRIDGE_CANNOT_END_IN_WATER, ERR_BRIDGE_HEADS_NOT_ON_SAME_HEIGHT } |
All bridge related error messages. More... | |
Static Public Member Functions | |
| static const char * | GetClassName () |
| static bool | IsValidBridge (BridgeID bridge_id) |
| Checks whether the given bridge type is valid. | |
| static bool | IsBridgeTile (TileIndex tile) |
| Checks whether the given tile is actually a bridge start or end tile. | |
| static BridgeID | GetBridgeID (TileIndex tile) |
| Get the BridgeID of a bridge at a given tile. | |
| static char * | GetName (BridgeID bridge_id) |
| Get the name of a bridge. | |
| static int32 | GetMaxSpeed (BridgeID bridge_id) |
| Get the maximum speed of a bridge. | |
| static Money | GetPrice (BridgeID bridge_id, uint length) |
| Get the new cost of a bridge. | |
| static int32 | GetMaxLength (BridgeID bridge_id) |
| Get the maximum length of a bridge. | |
| static int32 | GetMinLength (BridgeID bridge_id) |
| Get the minimum length of a bridge. | |
| static bool | _BuildBridgeRoad1 () |
| Internal function to help BuildBridge in case of road. | |
| static bool | _BuildBridgeRoad2 () |
| Internal function to help BuildBridge in case of road. | |
| static bool | BuildBridge (AIVehicle::VehicleType vehicle_type, BridgeID bridge_id, TileIndex start, TileIndex end) |
| Build a bridge from one tile to the other. | |
| static bool | RemoveBridge (TileIndex tile) |
| Removes a bridge, by executing it on either the start or end tile. | |
| static TileIndex | GetOtherBridgeEnd (TileIndex tile) |
| Get the tile that is on the other end of a bridge starting at tile. | |
Class that handles all bridge related functions.
Definition at line 22 of file ai_bridge.hpp.
All bridge related error messages.
Definition at line 27 of file ai_bridge.hpp.
| bool AIBridge::BuildBridge | ( | AIVehicle::VehicleType | vehicle_type, | |
| BridgeID | bridge_id, | |||
| TileIndex | start, | |||
| TileIndex | end | |||
| ) | [static] |
Build a bridge from one tile to the other.
As an extra for road, this functions builds two half-pieces of road on each end of the bridge, making it easier for you to connect it to your network.
| vehicle_type | The vehicle-type of bridge to build. | |
| bridge_id | The bridge-type to build. | |
| start | Where to start the bridge. | |
| end | Where to end the bridge. |
Definition at line 61 of file ai_bridge.cpp.
References CMD_BUILD_BRIDGE, AIObject::DoCommand(), EnforcePrecondition, AIRail::GetCurrentRailType(), AIObject::GetRoadType(), AIRail::IsRailTypeAvailable(), IsValidTile(), RoadTypeToRoadTypes(), AIObject::SetCallbackVariable(), TileX(), TileY(), TRANSPORT_RAIL, TRANSPORT_ROAD, TRANSPORT_WATER, AIVehicle::VT_RAIL, AIVehicle::VT_ROAD, and AIVehicle::VT_WATER.
Get the BridgeID of a bridge at a given tile.
| tile | The tile to get the BridgeID from. |
Definition at line 31 of file ai_bridge.cpp.
References GetBridgeType(), and IsBridgeTile().
| int32 AIBridge::GetMaxLength | ( | BridgeID | bridge_id | ) | [static] |
Get the maximum length of a bridge.
| bridge_id | The bridge to get the maximum length of. |
Definition at line 150 of file ai_bridge.cpp.
References _settings_game, GameSettings::construction, IsValidBridge(), ConstructionSettings::longbridges, and max().
Referenced by AIBridgeList_Length::AIBridgeList_Length().
| int32 AIBridge::GetMaxSpeed | ( | BridgeID | bridge_id | ) | [static] |
Get the maximum speed of a bridge.
| bridge_id | The bridge to get the maximum speed of. |
Definition at line 136 of file ai_bridge.cpp.
References IsValidBridge().
| int32 AIBridge::GetMinLength | ( | BridgeID | bridge_id | ) | [static] |
Get the minimum length of a bridge.
| bridge_id | The bridge to get the minimum length of. |
Definition at line 159 of file ai_bridge.cpp.
References IsValidBridge().
Referenced by AIBridgeList_Length::AIBridgeList_Length().
| char * AIBridge::GetName | ( | BridgeID | bridge_id | ) | [static] |
Get the name of a bridge.
| bridge_id | The bridge to get the name of. |
Definition at line 125 of file ai_bridge.cpp.
References IsValidBridge().
Get the tile that is on the other end of a bridge starting at tile.
| tile | The tile that is an end of a bridge. |
Definition at line 166 of file ai_bridge.cpp.
References INVALID_TILE, IsBridgeTile(), and IsValidTile().
Get the new cost of a bridge.
| bridge_id | The bridge to get the new cost of. | |
| length | The length of the bridge. |
Definition at line 143 of file ai_bridge.cpp.
References CalcBridgeLenCostFactor(), and IsValidBridge().
| bool AIBridge::IsBridgeTile | ( | TileIndex | tile | ) | [static] |
Checks whether the given tile is actually a bridge start or end tile.
| tile | The tile to check. |
Definition at line 25 of file ai_bridge.cpp.
References IsValidTile().
Referenced by GetBridgeID(), GetOtherBridgeEnd(), and RemoveBridge().
| bool AIBridge::IsValidBridge | ( | BridgeID | bridge_id | ) | [static] |
Checks whether the given bridge type is valid.
| bridge_id | The bridge to check. |
Definition at line 20 of file ai_bridge.cpp.
References _cur_year.
Referenced by AIBridgeList_Length::AIBridgeList_Length(), GetMaxLength(), GetMaxSpeed(), GetMinLength(), GetName(), and GetPrice().
| bool AIBridge::RemoveBridge | ( | TileIndex | tile | ) | [static] |
Removes a bridge, by executing it on either the start or end tile.
| tile | An end or start tile of the bridge. |
| AIError::ERR_OWNED_BY_ANOTHER_COMPANY |
Definition at line 119 of file ai_bridge.cpp.
References CMD_LANDSCAPE_CLEAR, AIObject::DoCommand(), EnforcePrecondition, and IsBridgeTile().
1.6.1