changeset 1965:8e31c77fe83c draft

(svn r2471) - Fix: [ 1221249 ] [NPF] Vehicles try to drive into a tunnel entrance from above.
author matthijs <matthijs@openttd.org>
date Wed, 22 Jun 2005 01:06:04 +0000
parents b114624760df
children f2dd793ad872
files npf.c
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/npf.c
+++ b/npf.c
@@ -461,6 +461,12 @@
 		}
 	}
 
+	/* I can't enter a tunnel entry/exit tile from a tile above the tunnel. Note
+	 * that I can enter the tunnel from a tile below the tunnel entrance. This
+	 * solves the problem of vehicles wanting to drive off a tunnel entrance */
+	if (IsTileType(dst_tile, MP_TUNNELBRIDGE) && (_map5[dst_tile] & 0xF0) == 0 && GetTileZ(dst_tile) < GetTileZ(src_tile))
+		return;
+
 	/* check correct rail type (mono, maglev, etc)
 	 * XXX: This now compares with the previous tile, which should not pose a
 	 * problem, but it might be nicer to compare with the first tile, or even