diff options
author | smatz <smatz@openttd.org> | 2008-01-23 22:34:04 +0000 |
---|---|---|
committer | smatz <smatz@openttd.org> | 2008-01-23 22:34:04 +0000 |
commit | 5a7c9037709772e4678ee57d9b42f5332bd66f97 (patch) | |
tree | ae76a3390a465cf3bfc011e2b32d53d5ae55c298 /src/yapf | |
parent | b5641ae0f2ca3723af7fe7f68c4ac45e113e8421 (diff) | |
download | openttd-5a7c9037709772e4678ee57d9b42f5332bd66f97.tar.xz |
(svn r11968) -Codechange: remove redundant FindLengthOfTunnel(), use GetTunnelBridgeLength() and/or GetOtherTunnelEnd() instead
Diffstat (limited to 'src/yapf')
-rw-r--r-- | src/yapf/follow_track.hpp | 38 | ||||
-rw-r--r-- | src/yapf/yapf.hpp | 1 |
2 files changed, 15 insertions, 24 deletions
diff --git a/src/yapf/follow_track.hpp b/src/yapf/follow_track.hpp index d6e0552a0..d4cd455b5 100644 --- a/src/yapf/follow_track.hpp +++ b/src/yapf/follow_track.hpp @@ -76,32 +76,22 @@ protected: m_is_station = m_is_bridge = m_is_tunnel = false; m_tiles_skipped = 0; - // extra handling for tunnels in our direction - if (IsTunnelTile(m_old_tile)) { - DiagDirection tunnel_enterdir = GetTunnelBridgeDirection(m_old_tile); - if (tunnel_enterdir == m_exitdir) { - // we are entering the tunnel - FindLengthOfTunnelResult flotr = FindLengthOfTunnel(m_old_tile, m_exitdir); - m_new_tile = flotr.tile; - m_is_tunnel = true; - m_tiles_skipped = flotr.length - 1; - return; - } - assert(ReverseDiagDir(tunnel_enterdir) == m_exitdir); - } - - // extra handling for bridge ramp in our direction - if (IsBridgeTile(m_old_tile)) { - DiagDirection bridge_enterdir = GetTunnelBridgeDirection(m_old_tile); - if (bridge_enterdir == m_exitdir) { - // we are entering the bridge ramp - m_new_tile = GetOtherBridgeEnd(m_old_tile); - uint32 bridge_length = GetBridgeLength(m_old_tile, m_new_tile); - m_tiles_skipped = bridge_length; - m_is_bridge = true; + // extra handling for tunnels and bridges in our direction + if (IsTileType(m_old_tile, MP_TUNNELBRIDGE)) { + DiagDirection enterdir = GetTunnelBridgeDirection(m_old_tile); + if (enterdir == m_exitdir) { + // we are entering the tunnel / bridge + if (IsTunnel(m_old_tile)) { + m_is_tunnel = true; + m_new_tile = GetOtherTunnelEnd(m_old_tile); + } else { // IsBridge(m_old_tile) + m_is_bridge = true; + m_new_tile = GetOtherBridgeEnd(m_old_tile); + } + m_tiles_skipped = GetTunnelBridgeLength(m_new_tile, m_old_tile); return; } - assert(ReverseDiagDir(bridge_enterdir) == m_exitdir); + assert(ReverseDiagDir(enterdir) == m_exitdir); } // normal or station tile, do one step diff --git a/src/yapf/yapf.hpp b/src/yapf/yapf.hpp index d728d0bfe..b98dfdf4b 100644 --- a/src/yapf/yapf.hpp +++ b/src/yapf/yapf.hpp @@ -23,6 +23,7 @@ #include "../waypoint.h" #include "../debug.h" #include "../settings_type.h" +#include "../tunnelbridge.h" extern uint64 _rdtsc(); |