(svn r501) -Fix: Vehicles slow down under bridge if the track is on a foundation
authortron
Wed, 03 Nov 2004 11:35:29 +0000
changeset 334 7e87a24e88b5
parent 333 be1ecd3b8f7c
child 335 cf36f9ff795c
(svn r501) -Fix: Vehicles slow down under bridge if the track is on a foundation
tunnelbridge_cmd.c
--- a/tunnelbridge_cmd.c	Wed Nov 03 11:06:21 2004 +0000
+++ b/tunnelbridge_cmd.c	Wed Nov 03 11:35:29 2004 +0000
@@ -1455,7 +1455,10 @@
 		}
 	} else if (_map5[tile] & 0x80) {
 		if (v->type == VEH_Road || (v->type == VEH_Train && v->subtype == 0)) {
-			if (GetTileSlope(tile, &h) != 0 || myabs(h - v->z_pos) > 2) {
+			if (GetTileSlope(tile, &h) != 0)
+				h += 8; // Compensate for possible foundation
+			if (!(_map5[tile] & 0x40) || // start/end tile of bridge
+					myabs(h - v->z_pos) > 2) { // high above the ground -> on the bridge
 				/* modify speed of vehicle */
 				uint16 spd = _bridge_speeds[_map2[tile] >> 4];
 				if (v->type == VEH_Road) spd<<=1;