summaryrefslogtreecommitdiff
path: root/src/pathfind.cpp
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2007-12-16 15:38:51 +0000
committersmatz <smatz@openttd.org>2007-12-16 15:38:51 +0000
commit926fe5c9e9e9fc3fd1b8ed9779812d54ee128adf (patch)
tree3adebd2b8c9a10a6d993c67b0b5920b3598f2bce /src/pathfind.cpp
parent8ce9c5f29b52cc9625bdda47594b4fad9e3dd242 (diff)
downloadopenttd-926fe5c9e9e9fc3fd1b8ed9779812d54ee128adf.tar.xz
(svn r11644) -Codechange: merge some functions from tunnel_map.h and bridge_map.h into tunnelbridge_map.h
Diffstat (limited to 'src/pathfind.cpp')
-rw-r--r--src/pathfind.cpp33
1 files changed, 17 insertions, 16 deletions
diff --git a/src/pathfind.cpp b/src/pathfind.cpp
index 2588c1c76..4cefc7125 100644
--- a/src/pathfind.cpp
+++ b/src/pathfind.cpp
@@ -17,6 +17,7 @@
#include "tunnel_map.h"
#include "variables.h"
#include "depot.h"
+#include "tunnelbridge_map.h"
/* remember which tiles we have already visited so we don't visit them again. */
static bool TPFSetTileBit(TrackPathFinder *tpf, TileIndex tile, int dir)
@@ -210,7 +211,7 @@ FindLengthOfTunnelResult FindLengthOfTunnel(TileIndex tile, DiagDirection dir)
tile += delta;
} while(
!IsTunnelTile(tile) ||
- GetTunnelDirection(tile) != dir ||
+ GetTunnelBridgeDirection(tile) != dir ||
GetTileZ(tile) != z
);
@@ -260,13 +261,13 @@ static inline void TPFMode1_NormalCase(TrackPathFinder* tpf, TileIndex tile, Til
* and transport type match */
if (IsTileType(tile, MP_TUNNELBRIDGE)) {
if (IsTunnel(tile)) {
- if (GetTunnelDirection(tile) != direction ||
- GetTunnelTransportType(tile) != tpf->tracktype) {
+ if (GetTunnelBridgeDirection(tile) != direction ||
+ GetTunnelBridgeTransportType(tile) != tpf->tracktype) {
return;
}
} else if (IsBridge(tile)) {
- if (GetBridgeRampDirection(tile) != direction ||
- GetBridgeTransportType(tile) != tpf->tracktype) {
+ if (GetTunnelBridgeDirection(tile) != direction ||
+ GetTunnelBridgeTransportType(tile) != tpf->tracktype) {
return;
}
}
@@ -307,23 +308,23 @@ static void TPFMode1(TrackPathFinder* tpf, TileIndex tile, DiagDirection directi
if (IsTileType(tile, MP_TUNNELBRIDGE)) {
if (IsTunnel(tile)) {
- if (GetTunnelTransportType(tile) != tpf->tracktype) {
+ if (GetTunnelBridgeTransportType(tile) != tpf->tracktype) {
return;
}
/* Only skip through the tunnel if heading inwards. We can
* be headed outwards if our starting position was in a
* tunnel and we're pathfinding backwards */
- if (GetTunnelDirection(tile) == direction) {
+ if (GetTunnelBridgeDirection(tile) == direction) {
tile = SkipToEndOfTunnel(tpf, tile, direction);
- } else if (GetTunnelDirection(tile) != ReverseDiagDir(direction)) {
+ } else if (GetTunnelBridgeDirection(tile) != ReverseDiagDir(direction)) {
/* We don't support moving through the sides of a tunnel
* entrance :-) */
return;
}
} else {
TileIndex tile_end;
- if (GetBridgeRampDirection(tile) != direction ||
- GetBridgeTransportType(tile) != tpf->tracktype) {
+ if (GetTunnelBridgeDirection(tile) != direction ||
+ GetTunnelBridgeTransportType(tile) != tpf->tracktype) {
return;
}
//fprintf(stderr, "%s: Planning over bridge\n", __func__);
@@ -722,12 +723,12 @@ start_at:
* need to find the exit of the tunnel. */
if (IsTileType(tile, MP_TUNNELBRIDGE)) {
if (IsTunnel(tile)) {
- if (GetTunnelDirection(tile) != ReverseDiagDir(direction)) {
+ if (GetTunnelBridgeDirection(tile) != ReverseDiagDir(direction)) {
FindLengthOfTunnelResult flotr;
/* We are not just driving out of the tunnel */
- if (GetTunnelDirection(tile) != direction ||
- GetTunnelTransportType(tile) != tpf->tracktype) {
+ if (GetTunnelBridgeDirection(tile) != direction ||
+ GetTunnelBridgeTransportType(tile) != tpf->tracktype) {
/* We are not driving into the tunnel, or it is an invalid tunnel */
continue;
}
@@ -742,10 +743,10 @@ start_at:
}
} else {
TileIndex tile_end;
- if (GetBridgeRampDirection(tile) != ReverseDiagDir(direction)) {
+ if (GetTunnelBridgeDirection(tile) != ReverseDiagDir(direction)) {
/* We are not just leaving the bridge */
- if (GetBridgeRampDirection(tile) != direction ||
- GetBridgeTransportType(tile) != tpf->tracktype) {
+ if (GetTunnelBridgeDirection(tile) != direction ||
+ GetTunnelBridgeTransportType(tile) != tpf->tracktype) {
/* Not entering the bridge or not compatible */
continue;
}