# tunnel_map.cpp File Reference

`#include "stdafx.h"`
`#include "openttd.h"`
`#include "tunnel_map.h"`
`#include "tunnelbridge_map.h"`

Go to the source code of this file.

## Functions
TileIndex | GetOtherTunnelEnd (TileIndex tile)
| Gets the other end of the tunnel.
bool | IsTunnelInWayDir (TileIndex tile, uint z, DiagDirection dir)
| Is there a tunnel in the way in the given direction?
bool | IsTunnelInWay (TileIndex tile, uint z)
| Is there a tunnel in the way in any direction?

## Detailed Description

Definition in file tunnel_map.cpp.

## Function Documentation

TileIndex GetOtherTunnelEnd | ( | TileIndex | tile | ) |

Gets the other end of the tunnel.

Where a vehicle would reappear when it enters at the given tile.

Parameters:

  | tile | the tile to search from.

Returns:
  the tile of the other end of the tunnel.

Definition at line 17 of file tunnel_map.cpp.

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

Referenced by CFollowTrackT< Ttr_type_, T90deg_turns_allowed_ >::FollowTileExit(), and GetOtherTunnelBridgeEnd().

bool IsTunnelInWay | ( | TileIndex | tile,
|  | uint | z |
| ) |  |  |

Is there a tunnel in the way in any direction?

Parameters:

  | tile | the tile to search from.
  | z | the 'z' to search on.

Returns:
  true if and only if there is a tunnel.

Definition at line 65 of file tunnel_map.cpp.

References DIAGDIR_NE, DIAGDIR_NW, DIAGDIR_SE, DIAGDIR_SW, IsTunnelInWayDir(), MapMaxX(), MapMaxY(), TileX(), and TileY().

Referenced by CmdTerraformLand().

bool IsTunnelInWayDir | ( | TileIndex | tile,
|  | uint | z,
|  | DiagDirection | dir |
| ) |  |  |

Is there a tunnel in the way in the given direction?

Parameters:

  | tile | the tile to search from.
  | z | the 'z' to search on.
  | dir | the direction to start searching to.

Returns:
  true if and only if there is a tunnel.

Definition at line 43 of file tunnel_map.cpp.

References GetTunnelBridgeDirection(), IsTunnelTile(), and TileOffsByDiagDir().

Referenced by CmdBuildTunnel(), and IsTunnelInWay().