OpenTTD
|
Header file for bridges. More...
Go to the source code of this file.
Data Structures | |
struct | BridgeSpec |
Struct containing information about a single bridge type. More... |
Typedefs | |
typedef uint | BridgeType |
Bridge spec number. |
Enumerations | |
enum | BridgePieces { BRIDGE_PIECE_NORTH = 0, BRIDGE_PIECE_SOUTH, BRIDGE_PIECE_INNER_NORTH, BRIDGE_PIECE_INNER_SOUTH, BRIDGE_PIECE_MIDDLE_ODD, BRIDGE_PIECE_MIDDLE_EVEN, BRIDGE_PIECE_HEAD, BRIDGE_PIECE_INVALID } |
This enum is related to the definition of bridge pieces, which is used to determine the proper sprite table to use while drawing a given bridge part. |
Functions | |
Foundation | GetBridgeFoundation (Slope tileh, Axis axis) |
Get the foundation for a bridge. | |
bool | HasBridgeFlatRamp (Slope tileh, Axis axis) |
Determines if the track on a bridge ramp is flat or goes up/down. | |
static const BridgeSpec * | GetBridgeSpec (BridgeType i) |
Get the specification of a bridge type. | |
void | DrawBridgeMiddle (const TileInfo *ti) |
Draw the middle bits of a bridge. | |
CommandCost | CheckBridgeAvailability (BridgeType bridge_type, uint bridge_len, DoCommandFlag flags=DC_NONE) |
Is a bridge of the specified type and length available? | |
int | CalcBridgeLenCostFactor (int x) |
Calculate the price factor for building a long bridge. | |
void | ResetBridges () |
Reset the data been eventually changed by the grf loaded. |
Variables | |
static const uint | MAX_BRIDGES = 13 |
Maximal number of available bridge specs. | |
BridgeSpec | _bridge [MAX_BRIDGES] |
The specification of all bridges. |
Header file for bridges.
Definition in file bridge.h.
int CalcBridgeLenCostFactor | ( | int | length | ) |
Calculate the price factor for building a long bridge.
Basically the cost delta is 1,1, 1, 2,2, 3,3,3, 4,4,4,4, 5,5,5,5,5, 6,6,6,6,6,6, 7,7,7,7,7,7,7, 8,8,8,8,8,8,8,8,
length | Length of the bridge. |
Definition at line 105 of file tunnelbridge_cmd.cpp.
Referenced by CmdBuildBridge(), and ShowBuildBridgeWindow().
CommandCost CheckBridgeAvailability | ( | BridgeType | bridge_type, |
uint | bridge_len, | ||
DoCommandFlag | flags | ||
) |
Is a bridge of the specified type and length available?
bridge_type | Wanted type of bridge. |
bridge_len | Wanted length of the bridge. |
Definition at line 209 of file tunnelbridge_cmd.cpp.
References _cur_year, _settings_game, BridgeSpec::avail_year, CMD_ERROR, GameSettings::construction, DC_QUERY_COST, GetBridgeSpec(), max(), ConstructionSettings::max_bridge_length, MAX_BRIDGES, BridgeSpec::max_length, min(), BridgeSpec::min_length, and return_cmd_error.
Referenced by CmdBuildBridge(), and ShowBuildBridgeWindow().
void DrawBridgeMiddle | ( | const TileInfo * | ti | ) |
Draw the middle bits of a bridge.
ti | Tile information of the tile to draw it on. |
Definition at line 1391 of file tunnelbridge_cmd.cpp.
References _settings_client, AddSortableSpriteToDraw(), AXIS_X, RailtypeInfo::base_sprites, BB_Z_SEPARATOR, RailtypeInfo::bridge_offset, BRIDGE_Z_START, CalcBridgePiece(), DrawBridgePillars(), DrawBridgeTramBits(), DrawGroundSpriteAt(), DrawRailCatenaryOnBridge(), EndSpriteCombine(), GetBridgeAxis(), GetBridgePixelHeight(), GetBridgeSpec(), GetBridgeType(), GetCustomRailSprite(), GetNorthernBridgeEnd(), GetRailType(), GetRailTypeInfo(), GetRoadTypes(), GetSouthernBridgeEnd(), GetTunnelBridgeLength(), GetTunnelBridgeTransportType(), ClientSettings::gui, HasBit(), HasRailCatenaryDrawn(), HasTunnelBridgeReservation(), IsBridgeAbove(), IsInvisibilitySet(), IsTransparencySet(), PalSpriteID::pal, PALETTE_CRASH, PALETTE_MODIFIER_TRANSPARENT, PALETTE_TO_TRANSPARENT, ROADTYPE_ROAD, ROADTYPE_TRAM, RTO_X, RTSG_BRIDGE, RTSG_OVERLAY, SetBit(), GUISettings::show_track_reservation, RailtypeInfo::single_x, RailtypeInfo::single_y, PalSpriteID::sprite, SPRITE_MASK, StartSpriteCombine(), TCX_ON_BRIDGE, TileInfo::tile, TILE_HEIGHT, TO_BRIDGES, TRANSPORT_RAIL, TRANSPORT_ROAD, TRANSPORT_WATER, TileInfo::x, TileInfo::y, and TileInfo::z.
Referenced by DrawTile_Road(), and DrawTile_TunnelBridge().
Foundation GetBridgeFoundation | ( | Slope | tileh, |
Axis | axis | ||
) |
Get the foundation for a bridge.
tileh | The slope to build the bridge on. |
axis | The axis of the bridge entrance. |
Definition at line 126 of file tunnelbridge_cmd.cpp.
References AXIS_X, AXIS_Y, FlatteningFoundation(), FOUNDATION_NONE, HasSlopeHighestCorner(), InclinedFoundation(), SLOPE_FLAT, SLOPE_NE, SLOPE_NW, SLOPE_SE, and SLOPE_SW.
Referenced by CheckBridgeSlopeNorth(), CheckBridgeSlopeSouth(), DrawRailCatenaryRailway(), DrawTile_TunnelBridge(), GetBridgeHeight(), and HasBridgeFlatRamp().
|
inlinestatic |
Get the specification of a bridge type.
i | The type of bridge to get the specification for. |
Definition at line 67 of file bridge.h.
References lengthof.
Referenced by CheckBridgeAvailability(), CmdBuildBridge(), DrawBridgeMiddle(), RoadVehicle::GetCurrentMaxSpeed(), Train::GetCurrentMaxSpeed(), CFollowTrackT< Ttr_type_, VehicleType, T90deg_turns_allowed_, Tmask_reserved_tracks >::GetSpeedLimit(), and ShowBuildBridgeWindow().
Determines if the track on a bridge ramp is flat or goes up/down.
tileh | Slope of the tile under the bridge head |
axis | Orientation of bridge |
Definition at line 142 of file tunnelbridge_cmd.cpp.
References ApplyFoundationToSlope(), GetBridgeFoundation(), and SLOPE_FLAT.
Referenced by DrawTile_TunnelBridge(), and CYapfCostBase::stSlopeCost().
void ResetBridges | ( | ) |
Reset the data been eventually changed by the grf loaded.
Definition at line 83 of file tunnelbridge_cmd.cpp.
References free(), and MAX_BRIDGES.
Referenced by ResetNewGRFData().