OpenTTD Source 20241224-master-gf74b0cf984
tunnelbridge_map.h File Reference

Functions that have tunnels and bridges in common. More...

#include "bridge_map.h"
#include "tunnel_map.h"

Go to the source code of this file.

Functions

DiagDirection GetTunnelBridgeDirection (Tile t)
 Get the direction pointing to the other end.
 
TransportType GetTunnelBridgeTransportType (Tile t)
 Tunnel: Get the transport type of the tunnel (road or rail) Bridge: Get the transport type of the bridge's ramp.
 
bool HasTunnelBridgeSnowOrDesert (Tile t)
 Tunnel: Is this tunnel entrance in a snowy or desert area? Bridge: Does the bridge ramp lie in a snow or desert area?
 
void SetTunnelBridgeSnowOrDesert (Tile t, bool snow_or_desert)
 Tunnel: Places this tunnel entrance in a snowy or desert area, or takes it out of there.
 
TileIndex GetOtherTunnelBridgeEnd (Tile t)
 Determines type of the wormhole and returns its other end.
 
bool HasTunnelBridgeReservation (Tile t)
 Get the reservation state of the rail tunnel/bridge.
 
void SetTunnelBridgeReservation (Tile t, bool b)
 Set the reservation state of the rail tunnel/bridge.
 
TrackBits GetTunnelBridgeReservationTrackBits (Tile t)
 Get the reserved track bits for a rail tunnel/bridge.
 

Detailed Description

Functions that have tunnels and bridges in common.

Definition in file tunnelbridge_map.h.

Function Documentation

◆ GetOtherTunnelBridgeEnd()

◆ GetTunnelBridgeDirection()

◆ GetTunnelBridgeReservationTrackBits()

TrackBits GetTunnelBridgeReservationTrackBits ( Tile  t)
inline

Get the reserved track bits for a rail tunnel/bridge.

Precondition
IsTileType(t, MP_TUNNELBRIDGE) && GetTunnelBridgeTransportType(t) == TRANSPORT_RAIL
Parameters
tthe tile
Returns
reserved track bits

Definition at line 117 of file tunnelbridge_map.h.

References DiagDirToDiagTrackBits(), GetTunnelBridgeDirection(), HasTunnelBridgeReservation(), and TRACK_BIT_NONE.

Referenced by GetReservedTrackbits(), and TryReserveRailTrack().

◆ GetTunnelBridgeTransportType()

◆ HasTunnelBridgeReservation()

bool HasTunnelBridgeReservation ( Tile  t)
inline

Get the reservation state of the rail tunnel/bridge.

Precondition
IsTileType(t, MP_TUNNELBRIDGE) && GetTunnelBridgeTransportType(t) == TRANSPORT_RAIL
Parameters
tthe tile
Returns
reservation state

Definition at line 91 of file tunnelbridge_map.h.

References GetTunnelBridgeTransportType(), HasBit(), IsTileType(), Tile::m5(), MP_TUNNELBRIDGE, and TRANSPORT_RAIL.

Referenced by CmdBuildBridge(), CmdConvertRail(), DoClearBridge(), DoClearTunnel(), DrawBridgeMiddle(), DrawTile_TunnelBridge(), and GetTunnelBridgeReservationTrackBits().

◆ HasTunnelBridgeSnowOrDesert()

bool HasTunnelBridgeSnowOrDesert ( Tile  t)
inline

Tunnel: Is this tunnel entrance in a snowy or desert area? Bridge: Does the bridge ramp lie in a snow or desert area?

Parameters
tThe tile to analyze
Precondition
IsTileType(t, MP_TUNNELBRIDGE)
Returns
true if and only if the tile is in a snowy/desert area

Definition at line 52 of file tunnelbridge_map.h.

References HasBit(), IsTileType(), Tile::m7(), and MP_TUNNELBRIDGE.

Referenced by DrawTile_TunnelBridge(), and GetTerrainType().

◆ SetTunnelBridgeReservation()

void SetTunnelBridgeReservation ( Tile  t,
bool  b 
)
inline

Set the reservation state of the rail tunnel/bridge.

Precondition
IsTileType(t, MP_TUNNELBRIDGE) && GetTunnelBridgeTransportType(t) == TRANSPORT_RAIL
Parameters
tthe tile
bthe reservation state

Definition at line 104 of file tunnelbridge_map.h.

References AssignBit(), GetTunnelBridgeTransportType(), IsTileType(), Tile::m5(), MP_TUNNELBRIDGE, and TRANSPORT_RAIL.

Referenced by AfterLoadGame(), ClearPathReservation(), CmdBuildBridge(), Train::Crash(), TryReserveRailTrack(), and UnreserveRailTrack().

◆ SetTunnelBridgeSnowOrDesert()

void SetTunnelBridgeSnowOrDesert ( Tile  t,
bool  snow_or_desert 
)
inline

Tunnel: Places this tunnel entrance in a snowy or desert area, or takes it out of there.

Bridge: Sets whether the bridge ramp lies in a snow or desert area.

Parameters
tthe tunnel entrance / bridge ramp tile
snow_or_desertis the entrance/ramp in snow or desert (true), when not in snow and not in desert false
Precondition
IsTileType(t, MP_TUNNELBRIDGE)

Definition at line 66 of file tunnelbridge_map.h.

References IsTileType(), Tile::m7(), MP_TUNNELBRIDGE, and SB().