FS#161 - (Old) pathfinder does not check railtypes

Attached to Project: OpenTTD
Opened by Remko Bijker (Rubidium) - Wednesday, 10 May 2006, 07:27 GMT
Last edited by Celestar (Celestar) - Wednesday, 10 May 2006, 09:42 GMT
Type Bug
Category Core
Status Closed
Assigned To Celestar (Celestar)
Operating System All
Severity Low
Priority Normal
Reported Version 0.4.7
Due in Version 0.4.8
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


The old pathfinder (pathfind.c/NTP), in NTPEnum (in 0.4.7), does not check for railtypes. This results in a train favouring the shortest path of rails even if the path contains incompatible railtypes (see the attachment for an example). The train will, sometimes, take the correct route, but with the new pathfinder (NPF) routes it always over the correct route.

There are, as far as I found, three distinct places where the checks need to be added (line numbers indicate start of block in 0.4.7):

The first case (line 718), where the tile is a tunnel tile, exists in both 0.4.7 and the current trunk version.

The second case (line 750), where the tile is not a 'normal (or signalled) rail tile', so a bridge, depot, waypoint or level crossing, exists in both 0.4.7 and the current trunk version. Fixing this can be difficult as you need to get the direction of the train for the bridge to get the correct railtype.

The third case (line 770), where the tile is a normal (or signalled) rail tile is fixed in trunk by rev 4008+4110 (elrails), but it is not backported to 0.4.7. This can therefore easily be fixed by backporting the fix.
This task depends upon

This task blocks these from closing
 FS#182 - Pathfinding (old) problem on bridges 
Closed by  Celestar (Celestar)
Wednesday, 10 May 2006, 09:42 GMT
Reason for closing:  Fixed
Comment by Remko Bijker (Rubidium) - Wednesday, 10 May 2006, 09:27 GMT
Savegame that shows all the failing scenarios. The trains will not always take the wrong route, but it takes the wrong route sometimes after a few tries, while NPF never takes the wrong route after a few tries.