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

Header file for things common for tunnels and bridges. More...

#include "map_func.h"
#include "tile_map.h"

Go to the source code of this file.

Functions

void MarkBridgeDirty (TileIndex begin, TileIndex end, DiagDirection direction, uint bridge_height)
 Mark bridge tiles dirty.
 
void MarkBridgeDirty (TileIndex tile)
 Mark bridge tiles dirty.
 
uint GetTunnelBridgeLength (TileIndex begin, TileIndex end)
 Calculates the length of a tunnel or a bridge (without end tiles)
 
void SetTunnelBridgeOwner (TileIndex begin, TileIndex end, Owner owner)
 Sets the ownership of the bridge/tunnel ramps.
 

Variables

TileIndex _build_tunnel_endtile
 The end of a tunnel; as hidden return from the tunnel build command for GUI purposes.
 

Detailed Description

Header file for things common for tunnels and bridges.

Definition in file tunnelbridge.h.

Function Documentation

◆ GetTunnelBridgeLength()

uint GetTunnelBridgeLength ( TileIndex  begin,
TileIndex  end 
)
inline

Calculates the length of a tunnel or a bridge (without end tiles)

Parameters
beginThe begin of the tunnel or bridge.
endThe end of the tunnel or bridge.
Returns
length of bridge/tunnel middle

Definition at line 25 of file tunnelbridge.h.

References abs(), TileX(), and TileY().

Referenced by CmdBuildBridge(), CmdBuildRoad(), CmdConvertRail(), CmdConvertRoad(), CmdSignalTrackHelper(), DoClearBridge(), DoClearTunnel(), DrawBridgeMiddle(), DrawRailCatenaryOnBridge(), CFollowTrackT< Ttr_type_, VehicleType, T90deg_turns_allowed_, Tmask_reserved_tracks >::FollowTileExit(), GetRailTrackBitsUniversal(), RemoveRoad(), and ShowBuildBridgeWindow().

◆ MarkBridgeDirty() [1/2]

void MarkBridgeDirty ( TileIndex  begin,
TileIndex  end,
DiagDirection  direction,
uint  bridge_height 
)

Mark bridge tiles dirty.

Note: The bridge does not need to exist, everything is passed via parameters.

Parameters
beginStart tile.
endEnd tile.
directionDirection from begin to end.
bridge_heightBridge height level.

Definition at line 67 of file tunnelbridge_cmd.cpp.

References MarkTileDirtyByTile(), TileHeight(), and TileOffsByDiagDir().

Referenced by ClearPathReservation(), CmdBuildBridge(), CmdBuildRoad(), CmdConvertRail(), CmdConvertRoad(), MarkBridgeDirty(), RemoveRoad(), TryReserveRailTrack(), and UnreserveRailTrack().

◆ MarkBridgeDirty() [2/2]

void MarkBridgeDirty ( TileIndex  tile)

Mark bridge tiles dirty.

Parameters
tileBridge head.

Definition at line 80 of file tunnelbridge_cmd.cpp.

References GetBridgeHeight(), GetOtherTunnelBridgeEnd(), GetTunnelBridgeDirection(), and MarkBridgeDirty().

◆ SetTunnelBridgeOwner()

void SetTunnelBridgeOwner ( TileIndex  begin,
TileIndex  end,
Owner  owner 
)
inline

Sets the ownership of the bridge/tunnel ramps.

Parameters
beginThe begin of the tunnel or bridge.
endThe end of the tunnel or bridge.
ownerThe new owner to set

Definition at line 41 of file tunnelbridge.h.

References SetTileOwner().

Referenced by CmdConvertRoad().

Variable Documentation

◆ _build_tunnel_endtile

TileIndex _build_tunnel_endtile
extern

The end of a tunnel; as hidden return from the tunnel build command for GUI purposes.

Definition at line 53 of file tunnelbridge_cmd.cpp.

Referenced by CcBuildRailTunnel(), CcBuildRoadTunnel(), CmdBuildTunnel(), DoClearTunnel(), BuildRailToolbarWindow::OnPlacePresize(), and BuildRoadToolbarWindow::OnPlacePresize().