|
OpenTTD Source 20251117-master-g7398d2e290
|
Header file for bridges. More...
#include "gfx_type.h"#include "tile_cmd.h"#include "timer/timer_game_calendar.h"#include "bridge_type.h"Go to the source code of this file.
Data Structures | |
| struct | BridgeSpec |
| Struct containing information about a single bridge type. More... | |
Typedefs | |
| using | BridgeMiddlePillarFlags = std::array< std::array< BridgePillarFlags, AXIS_END >, NUM_BRIDGE_MIDDLE_PIECES > |
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. | |
| const BridgeSpec * | GetBridgeSpec (BridgeType i) |
| Get the specification of a bridge type. | |
| void | DrawBridgeMiddle (const TileInfo *ti, BridgePillarFlags blocked_pillars) |
| Draw the middle bits of a bridge. | |
| CommandCost | CheckBridgeAvailability (BridgeType bridge_type, uint bridge_len, DoCommandFlags flags={}) |
| 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. | |
| constexpr uint | SPRITES_PER_BRIDGE_PIECE = 32 |
| Number of sprites there are per bridge piece. | |
| BridgeSpec | _bridge [MAX_BRIDGES] |
| The specification of all bridges. | |
Header file for bridges.
Definition in file bridge.h.
| using BridgeMiddlePillarFlags = std::array<std::array<BridgePillarFlags, AXIS_END>, NUM_BRIDGE_MIDDLE_PIECES> |
| 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 94 of file tunnelbridge_cmd.cpp.
Referenced by CmdBuildBridge(), and ShowBuildBridgeWindow().
| CommandCost CheckBridgeAvailability | ( | BridgeType | bridge_type, |
| uint | bridge_len, | ||
| DoCommandFlags | flags | ||
| ) |
Is a bridge of the specified type and length available?
| bridge_type | Wanted type of bridge. |
| bridge_len | Wanted length of the bridge. |
| flags | Type of operation. |
Definition at line 240 of file tunnelbridge_cmd.cpp.
References _settings_game, BridgeSpec::avail_year, CMD_ERROR, GameSettings::construction, GetBridgeSpec(), ConstructionSettings::max_bridge_length, MAX_BRIDGES, BridgeSpec::max_length, BridgeSpec::min_length, QueryCost, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), and TimerGameCalendar::year.
Referenced by CmdBuildBridge(), and ShowBuildBridgeWindow().
| void DrawBridgeMiddle | ( | const TileInfo * | ti, |
| BridgePillarFlags | blocked_pillars | ||
| ) |
Draw the middle bits of a bridge.
| ti | Tile information of the tile to draw it on. |
| blocked_pillars | Mask of pillar corners and edges blocked by tile below the bridge. |
Definition at line 1607 of file tunnelbridge_cmd.cpp.
References _settings_client, AddSortableSpriteToDraw(), AXIS_X, RailTypeInfo::base_sprites, BB_Z_SEPARATOR, RailTypeInfo::bridge_deck, BRIDGE_Z_START, BridgeHasCustomSpriteTable(), CalcBridgePiece(), DrawBridgeRoadBits(), DrawRailCatenaryOnBridge(), EndSpriteCombine(), GetBridgeAxis(), GetBridgeMiddleAxisBaseOffset(), GetBridgePixelHeight(), GetBridgeSpec(), GetBridgeSpriteTable(), GetBridgeSpriteTableBaseOffset(), GetBridgeTilePillarFlags(), GetBridgeType(), GetCustomRailSprite(), GetNorthernBridgeEnd(), GetRailType(), GetRailTypeInfo(), GetSouthernBridgeEnd(), GetTunnelBridgeLength(), GetTunnelBridgeTransportType(), ClientSettings::gui, HasBit(), HasRailCatenaryDrawn(), HasTunnelBridgeReservation(), IsBridgeAbove(), IsInvisibilitySet(), IsTransparencySet(), PALETTE_CRASH, RTO_X, RTSG_BRIDGE, RTSG_OVERLAY, GUISettings::show_track_reservation, RailTypeInfo::single_x, RailTypeInfo::single_y, StartSpriteCombine(), TCX_ON_BRIDGE, TileInfo::tile, TILE_HEIGHT, TILE_SIZE, TO_BRIDGES, TRANSPORT_RAIL, TRANSPORT_ROAD, TRANSPORT_WATER, Coord3D< T >::x, and Coord3D< T >::y.
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 115 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 CheckBridgeSlope(), DrawRailCatenaryRailway(), DrawTile_TunnelBridge(), GetBridgeHeight(), and HasBridgeFlatRamp().
|
inline |
Get the specification of a bridge type.
| i | The type of bridge to get the specification for. |
Definition at line 60 of file bridge.h.
References _bridge, and lengthof.
Referenced by BridgeHasCustomSpriteTable(), CheckBridgeAvailability(), CmdBuildBridge(), DrawBridgeMiddle(), GetBridgeSpriteTable(), GetBridgeTilePillarFlags(), 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 131 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 _bridge.
Referenced by ResetNewGRFData().
|
extern |
The specification of all bridges.
Definition at line 49 of file tunnelbridge_cmd.cpp.
Referenced by GetBridgeSpec(), and ResetBridges().
|
static |
Maximal number of available bridge specs.
Definition at line 18 of file bridge.h.
Referenced by CheckBridgeAvailability(), GrowTownWithBridge(), and ShowBuildBridgeWindow().