(svn r3777) Add some functions to handle tunnels

This commit is contained in:
tron
2006-03-06 20:55:24 +00:00
parent 2d3c28f2b3
commit f2dc736554
11 changed files with 132 additions and 46 deletions

25
tunnel_map.c Normal file
View File

@@ -0,0 +1,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;
}