summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatthijs <matthijs@openttd.org>2005-04-04 18:36:08 +0000
committermatthijs <matthijs@openttd.org>2005-04-04 18:36:08 +0000
commitead34df653458301e5d12e3ac66fc2904957b2b3 (patch)
treea90700427d92be3e97a4c9941d9c69a14af2c301
parent6c825df8f76442acf61f0c2f01620bdbff8a776f (diff)
downloadopenttd-ead34df653458301e5d12e3ac66fc2904957b2b3.tar.xz
(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.
-rw-r--r--npf.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/npf.c b/npf.c
index 3b50055a5..477cbcae1 100644
--- a/npf.c
+++ b/npf.c
@@ -507,9 +507,14 @@ void NPFFollowTrack(AyStar* aystar, OpenListNode* current) {
/* 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]));