summaryrefslogtreecommitdiff
path: root/npf.c
diff options
context:
space:
mode:
authortron <tron@openttd.org>2006-03-06 20:55:24 +0000
committertron <tron@openttd.org>2006-03-06 20:55:24 +0000
commitf2dc736554c06d69dd936131c4a09ddbc6b58083 (patch)
tree14ef1d7e7e885dff603aa06189b416a7bd2a6ae0 /npf.c
parent2d3c28f2b3d24c2b01e54a51e2dcf5ad7f4851c8 (diff)
downloadopenttd-f2dc736554c06d69dd936131c4a09ddbc6b58083.tar.xz
(svn r3777) Add some functions to handle tunnels
Diffstat (limited to 'npf.c')
-rw-r--r--npf.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/npf.c b/npf.c
index abefe239d..18818f679 100644
--- a/npf.c
+++ b/npf.c
@@ -11,6 +11,7 @@
#include "station.h"
#include "tile.h"
#include "depot.h"
+#include "tunnel_map.h"
static AyStar _npf_aystar;
@@ -162,7 +163,7 @@ static uint NPFTunnelCost(AyStarNode* current)
{
DiagDirection exitdir = TrackdirToExitdir((Trackdir)current->direction);
TileIndex tile = current->tile;
- if ((DiagDirection)GB(_m[tile].m5, 0, 2) == ReverseDiagDir(exitdir)) {
+ if (GetTunnelDirection(tile) == ReverseDiagDir(exitdir)) {
/* We just popped out if this tunnel, since were
* facing the tunnel exit */
FindLengthOfTunnelResult flotr;
@@ -519,7 +520,7 @@ static void NPFFollowTrack(AyStar* aystar, OpenListNode* current)
/* Find dest tile */
if (IsTileType(src_tile, MP_TUNNELBRIDGE) &&
GB(_m[src_tile].m5, 4, 4) == 0 &&
- (DiagDirection)GB(_m[src_tile].m5, 0, 2) == src_exitdir) {
+ GetTunnelDirection(src_tile) == src_exitdir) {
/* This is a tunnel. We know this tunnel is our type,
* otherwise we wouldn't have got here. It is also facing us,
* so we should skip it's body */