FS#5944 - Track type change breaks Two-Way EOL

Attached to Project: OpenTTD
Opened by Mingwei Samuel (Hazzard) - Sunday, 16 March 2014, 01:00 GMT
Last edited by andythenorth (andythenorth) - Wednesday, 23 August 2017, 07:08 GMT
Type Bug
Category Vehicles
Status With patch
Assigned To No-one
Operating System All
Severity Very Low
Priority Normal
Reported Version trunk
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 0
Private No


Version: r26379 (probably all versions)

When Two-Way EOL is enabled,
This task depends upon

Comment by Mingwei Samuel (Hazzard) - Sunday, 16 March 2014, 01:02 GMT
When Two-Way EOL is enabled, it will usually force a train into a depot. However, if the track (of the depot) is of a different type, the train will not be forced into the depot.
Comment by Mingwei Samuel (Hazzard) - Thursday, 20 March 2014, 04:32 GMT
Related to 5216
Comment by Círdan (cirdan) - Thursday, 27 March 2014, 20:37 GMT
I am interested in fixing this issue in my development branch, and I think I have found out what is going on. Could you please upload a savegame exhibiting this behaviour, so that I can do further testing?
Comment by Mingwei Samuel (Hazzard) - Friday, 28 March 2014, 03:52 GMT
You may need to enter "set yapf.rail_firstred_twoway_eol 1"
Note the different behavior when the depot is changed from electric to non-electric.
Comment by Círdan (cirdan) - Friday, 28 March 2014, 21:43 GMT
Thanks! Your savegame is perfect for testing.

What happens here is that the wrong branch is being pruned when the first signal found is a red two-way signal but the best intermediate node so far is behind a junction, because the code starts pruning at the best intermediate node instead of at the segment that ends at the signal.

I have published a fix in my development branch ( in case anyone wants to pick it up.
Comment by Charles Pigott (LordAro) - Friday, 18 August 2017, 22:05 GMT
Diff attached, for posterity