(svn r10739) [0.5] -Fix [FS#1096]: trains going over bridges would get the "going down hill" accelerate bonus, which causes trains to go faster on bridges than they would be going on level land. 0.5
authorrubidium
Tue, 31 Jul 2007 17:35:35 +0000
branch0.5
changeset 5528 b14613d2096f
parent 5527 cffb9a72506e
child 5529 6f98fbb23a33
(svn r10739) [0.5] -Fix [FS#1096]: trains going over bridges would get the "going down hill" accelerate bonus, which causes trains to go faster on bridges than they would be going on level land.
train_cmd.c
--- a/train_cmd.c	Mon Jul 30 10:24:04 2007 +0000
+++ b/train_cmd.c	Tue Jul 31 17:35:35 2007 +0000
@@ -2769,10 +2769,11 @@
 			static const int INV_TILE_SIZE_MASK = ~(TILE_SIZE - 1);
 
 			byte middle_z = GetSlopeZ((v->x_pos & INV_TILE_SIZE_MASK) | HALF_TILE_SIZE, (v->y_pos & INV_TILE_SIZE_MASK) | HALF_TILE_SIZE);
+			TileIndex tile = TileVirtXY(v->x_pos, v->y_pos);
 
 			/* For some reason tunnel tiles are always given as sloped :(
 			 * But they are not sloped... */
-			if (middle_z != v->z_pos && !IsTunnelTile(TileVirtXY(v->x_pos, v->y_pos))) {
+			if (middle_z != v->z_pos && !IsTunnelTile(tile) && !(IsBridgeTile(tile) && IsBridgeMiddle(tile))) {
 				SETBIT(v->u.rail.flags, (middle_z > old_z) ? VRF_GOINGUP : VRF_GOINGDOWN);
 			}
 		}