blob: d39c7ef0426cbdcbfe12c07dab7bf03a344f9f26 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
/* $Id$ */
#include "stdafx.h"
#include "openttd.h"
#include "tile.h"
#include "tunnel_map.h"
TileIndex GetOtherTunnelEnd(TileIndex tile)
{
DiagDirection dir = GetTunnelDirection(tile);
TileIndexDiff delta = TileOffsByDir(dir);
uint z = GetTileZ(tile);
dir = ReverseDiagDir(dir);
do {
tile += delta;
} while (
!IsTileType(tile, MP_TUNNELBRIDGE) ||
GB(_m[tile].m5, 4, 4) != 0 ||
GetTunnelDirection(tile) != dir ||
GetTileZ(tile) != z
);
return tile;
}
|