OpenTTD Source  20241120-master-g6d3adc6169
bridge_map.cpp File Reference

Map accessor functions for bridges. More...

#include "stdafx.h"
#include "landscape.h"
#include "tunnelbridge_map.h"
#include "safeguards.h"

Go to the source code of this file.

Functions

static TileIndex GetBridgeEnd (TileIndex tile, DiagDirection dir)
 Finds the end of a bridge in the specified direction starting at a middle tile. More...
 
TileIndex GetNorthernBridgeEnd (TileIndex t)
 Finds the northern end of a bridge starting at a middle tile. More...
 
TileIndex GetSouthernBridgeEnd (TileIndex t)
 Finds the southern end of a bridge starting at a middle tile. More...
 
TileIndex GetOtherBridgeEnd (TileIndex tile)
 Starting at one bridge end finds the other bridge end. More...
 
int GetBridgeHeight (TileIndex t)
 Get the height ('z') of a bridge. More...
 

Detailed Description

Map accessor functions for bridges.

Definition in file bridge_map.cpp.

Function Documentation

◆ GetBridgeEnd()

static TileIndex GetBridgeEnd ( TileIndex  tile,
DiagDirection  dir 
)
static

Finds the end of a bridge in the specified direction starting at a middle tile.

Parameters
tilethe bridge tile to find the bridge ramp for
dirthe direction to search in

Definition at line 22 of file bridge_map.cpp.

References GetTunnelBridgeDirection(), IsBridgeTile(), ReverseDiagDir(), and TileOffsByDiagDir().

Referenced by GetNorthernBridgeEnd(), GetOtherBridgeEnd(), and GetSouthernBridgeEnd().

◆ GetBridgeHeight()

int GetBridgeHeight ( TileIndex  t)

Get the height ('z') of a bridge.

Parameters
tthe bridge ramp tile to get the bridge height from
Returns
the height of the bridge.

Definition at line 70 of file bridge_map.cpp.

References ApplyFoundationToSlope(), DiagDirToAxis(), GetBridgeFoundation(), GetTileSlopeZ(), and GetTunnelBridgeDirection().

Referenced by CmdTerraformLand(), DrawRoadTypeCatenary(), GetBridgePixelHeight(), and MarkBridgeDirty().

◆ GetNorthernBridgeEnd()

TileIndex GetNorthernBridgeEnd ( TileIndex  t)

Finds the northern end of a bridge starting at a middle tile.

Parameters
tthe bridge tile to find the bridge ramp for

Definition at line 39 of file bridge_map.cpp.

References AxisToDiagDir(), GetBridgeAxis(), GetBridgeEnd(), and ReverseDiagDir().

Referenced by DrawBridgeMiddle(), and DrawRoadTypeCatenary().

◆ GetOtherBridgeEnd()

TileIndex GetOtherBridgeEnd ( TileIndex  tile)

Starting at one bridge end finds the other bridge end.

Parameters
tilethe bridge ramp tile to find the other bridge ramp for

Definition at line 59 of file bridge_map.cpp.

References GetBridgeEnd(), GetTunnelBridgeDirection(), and IsBridgeTile().

Referenced by DoClearBridge(), DrawRailCatenaryOnBridge(), FloodVehicles(), CFollowTrackT< Ttr_type_, VehicleType, T90deg_turns_allowed_, Tmask_reserved_tracks >::FollowTileExit(), GetOtherTunnelBridgeEnd(), and GetRailTrackBitsUniversal().

◆ GetSouthernBridgeEnd()

TileIndex GetSouthernBridgeEnd ( TileIndex  t)

Finds the southern end of a bridge starting at a middle tile.

Parameters
tthe bridge tile to find the bridge ramp for

Definition at line 49 of file bridge_map.cpp.

References AxisToDiagDir(), GetBridgeAxis(), and GetBridgeEnd().

Referenced by CmdTerraformLand(), DrawBridgeMiddle(), and DrawRailCatenaryOnBridge().