(svn r11644) -Codechange: merge some functions from tunnel_map.h and bridge_map.h into tunnelbridge_map.h

This commit is contained in:
smatz
2007-12-16 15:38:51 +00:00
parent ec90ce7e98
commit 3cee0abdba
28 changed files with 245 additions and 241 deletions

View File

@@ -78,7 +78,7 @@ protected:
// extra handling for tunnels in our direction
if (IsTunnelTile(m_old_tile)) {
DiagDirection tunnel_enterdir = GetTunnelDirection(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);
@@ -92,7 +92,7 @@ protected:
// extra handling for bridge ramp in our direction
if (IsBridgeTile(m_old_tile)) {
DiagDirection bridge_enterdir = GetBridgeRampDirection(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);
@@ -208,7 +208,7 @@ protected:
if (!IsWaterTT() && IsTileType(m_new_tile, MP_TUNNELBRIDGE)) {
if (IsTunnel(m_new_tile)) {
if (!m_is_tunnel) {
DiagDirection tunnel_enterdir = GetTunnelDirection(m_new_tile);
DiagDirection tunnel_enterdir = GetTunnelBridgeDirection(m_new_tile);
if (tunnel_enterdir != m_exitdir) {
m_err = EC_NO_WAY;
return false;
@@ -216,7 +216,7 @@ protected:
}
} else if (IsBridge(m_new_tile)) {
if (!m_is_bridge) {
DiagDirection ramp_enderdir = GetBridgeRampDirection(m_new_tile);
DiagDirection ramp_enderdir = GetTunnelBridgeDirection(m_new_tile);
if (ramp_enderdir != m_exitdir) {
m_err = EC_NO_WAY;
return false;

View File

@@ -12,6 +12,7 @@
#include "../road_map.h"
#include "../tunnel_map.h"
#include "../bridge_map.h"
#include "../tunnelbridge_map.h"
#include "../bridge.h"
#include "../station.h"
#include "../station_map.h"

View File

@@ -11,7 +11,7 @@ struct CYapfCostBase {
if (IsDiagonalTrackdir(td)) {
if (IsBridgeTile(tile)) {
// it is bridge ramp, check if we are entering the bridge
if (GetBridgeRampDirection(tile) != TrackdirToExitdir(td)) return false; // no, we are living it, no penalty
if (GetTunnelBridgeDirection(tile) != TrackdirToExitdir(td)) return false; // no, we are living it, no penalty
// we are entering the bridge
// if the tile slope is downwards, then bridge ramp has not upward slope
uint tile_slope = GetTileSlope(tile, NULL) & 0x0F;