tron@10050: /* $Id$ */ tron@10050: tron@10050: #include "stdafx.h" tron@10050: #include "openttd.h" tron@10050: #include "tile.h" tron@10050: #include "tunnel_map.h" tron@10050: tron@10050: static bool IsTunnelInWayDir(TileIndex tile, uint z, DiagDirection dir) tron@10050: { tron@10050: TileIndexDiff delta = TileOffsByDir(dir); tron@10050: uint height; tron@10050: tron@10050: do { tron@10050: tile -= delta; tron@10050: height = GetTileZ(tile); tron@10050: } while (z < height); tron@10050: tron@10050: return tron@10050: z == height && tron@10050: IsTunnelTile(tile) && tron@10050: GetTunnelDirection(tile) == dir; tron@10050: } tron@10050: tron@10050: bool IsTunnelInWay(TileIndex tile, uint z) tron@10050: { tron@10050: return tron@10050: IsTunnelInWayDir(tile, z, DIAGDIR_NE) || tron@10050: IsTunnelInWayDir(tile, z, DIAGDIR_SE) || tron@10050: IsTunnelInWayDir(tile, z, DIAGDIR_SW) || tron@10050: IsTunnelInWayDir(tile, z, DIAGDIR_NW); tron@10050: }