summaryrefslogtreecommitdiff
path: root/pathfind.c
diff options
context:
space:
mode:
authorcelestar <celestar@openttd.org>2006-03-29 16:30:26 +0000
committercelestar <celestar@openttd.org>2006-03-29 16:30:26 +0000
commita7d8ad0004e00e1d917d636f4d69fd58f5edbfa3 (patch)
treec1903bfd394f761768fa9d907c58a76229e1b2f8 /pathfind.c
parent9c96bcb9975c4f9e197cebf0562f81de5be99b5b (diff)
downloadopenttd-a7d8ad0004e00e1d917d636f4d69fd58f5edbfa3.tar.xz
(svn r4150) -Feature: Merged elrails into trunk. Thanks to Tron for lots of code and proofreading, thanks to peter1138 for another lot of code and ideas.
Diffstat (limited to 'pathfind.c')
-rw-r--r--pathfind.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/pathfind.c b/pathfind.c
index b70e51887..b6c268938 100644
--- a/pathfind.c
+++ b/pathfind.c
@@ -454,7 +454,8 @@ typedef struct {
void *userdata;
TileIndex dest;
- byte tracktype;
+ TransportType tracktype;
+ RailTypeMask railtypes;
uint maxlength;
HashLink *new_link;
@@ -791,6 +792,11 @@ start_at:
* bits, not just reachable ones, to prevent infinite loops. */
if (bits == 0 || TracksOverlap(allbits)) break;
+ if (!HASBIT(tpf->railtypes, GetRailType(tile))) {
+ bits = 0;
+ break;
+ }
+
/* If we reach here, the tile has exactly one track, and this
track is reachable => Rail segment continues */
@@ -926,14 +932,15 @@ start_at:
// new pathfinder for trains. better and faster.
-void NewTrainPathfind(TileIndex tile, TileIndex dest, DiagDirection direction, NTPEnumProc* enum_proc, void* data)
+void NewTrainPathfind(TileIndex tile, TileIndex dest, RailTypeMask railtypes, DiagDirection direction, NTPEnumProc* enum_proc, void* data)
{
NewTrackPathFinder tpf;
tpf.dest = dest;
tpf.userdata = data;
tpf.enum_proc = enum_proc;
- tpf.tracktype = 0;
+ tpf.tracktype = TRANSPORT_RAIL;
+ tpf.railtypes = railtypes;
tpf.maxlength = min(_patches.pf_maxlength * 3, 10000);
tpf.nstack = 0;
tpf.new_link = tpf.links;