# HG changeset patch # User matthijs # Date 1112639768 0 # Node ID 581b4e76ed362f577f2f40a8ca4bffaf3c6533ae # Parent 420cad9e62e440954434755b0e7545000c6e6655 (svn r2148) - Add: [NPF] Trains can now plan taking into account that they can reverse in depots. This makes forced servicing tracks work with NPF. diff -r 420cad9e62e4 -r 581b4e76ed36 npf.c --- a/npf.c Mon Apr 04 17:53:39 2005 +0000 +++ b/npf.c Mon Apr 04 18:36:08 2005 +0000 @@ -507,9 +507,14 @@ /* Let's see if were headed the right way */ if (src_trackdir != _dir_to_diag_trackdir[exitdir]) - /* Not going out of the station/depot through the exit, but the back. No - * neighbours then. */ - return; + /* We are headed inwards. We can only reverse here, so we'll not + * consider this direction, but jump ahead to the reverse direction. + * It would be nicer to return one neighbour here (the reverse + * trackdir of the one we are considering now) and then considering + * that one to return the tracks outside of the depot. But, because + * the code layout is cleaner this way, we will just pretend we are + * reversed already */ + src_trackdir = _reverse_trackdir[src_trackdir]; } /* This a normal tile, a bridge, a tunnel exit, etc. */ dst_tile = AddTileIndexDiffCWrap(src_tile, TileIndexDiffCByDir(_trackdir_to_exitdir[src_trackdir]));