summaryrefslogtreecommitdiff
path: root/src/tunnel_map.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-07-25 15:45:46 +0000
committerrubidium <rubidium@openttd.org>2007-07-25 15:45:46 +0000
commit8131ce7e21b93234d43e3c0c90319d44935a5b5a (patch)
tree7fa73f3c0eb16b6b0b664a6ec1e69ca355f7cb9f /src/tunnel_map.cpp
parent122ce21f32cd70a5b44e9238bb01ee95d0781f9a (diff)
downloadopenttd-8131ce7e21b93234d43e3c0c90319d44935a5b5a.tar.xz
(svn r10686) -Fix [FS#1058]: determining whether there is a tunnel going under the lowered area is only needed in two directions instead of all four, so take the directions (one for each axis) to the nearest border (along the given axis). Furthermore GetTileZ did much more than absolutely necessary.
Diffstat (limited to 'src/tunnel_map.cpp')
-rw-r--r--src/tunnel_map.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/tunnel_map.cpp b/src/tunnel_map.cpp
index 8d75735b6..593d3fe6b 100644
--- a/src/tunnel_map.cpp
+++ b/src/tunnel_map.cpp
@@ -64,8 +64,6 @@ bool IsTunnelInWayDir(TileIndex tile, uint z, DiagDirection dir)
bool IsTunnelInWay(TileIndex tile, uint z)
{
return
- IsTunnelInWayDir(tile, z, DIAGDIR_NE) ||
- IsTunnelInWayDir(tile, z, DIAGDIR_SE) ||
- IsTunnelInWayDir(tile, z, DIAGDIR_SW) ||
- IsTunnelInWayDir(tile, z, DIAGDIR_NW);
+ IsTunnelInWayDir(tile, z, (TileX(tile) > (MapMaxX() / 2)) ? DIAGDIR_NE : DIAGDIR_SW) ||
+ IsTunnelInWayDir(tile, z, (TileY(tile) > (MapMaxY() / 2)) ? DIAGDIR_NW : DIAGDIR_SE);
}