(svn r8687) [0.5] -Fix [FS#617]: assertion when getting the height of a bridge from the ramp tile. 0.5
authorrubidium
Mon, 12 Feb 2007 10:03:42 +0000
branch0.5
changeset 5439 7af52897085a
parent 5438 024eb27ab119
child 5440 2b772a3294e9
(svn r8687) [0.5] -Fix [FS#617]: assertion when getting the height of a bridge from the ramp tile.
bridge.h
tunnelbridge_cmd.c
water_cmd.c
--- a/bridge.h	Fri Feb 09 11:13:03 2007 +0000
+++ b/bridge.h	Mon Feb 12 10:03:42 2007 +0000
@@ -27,5 +27,6 @@
 extern Bridge _bridge[MAX_BRIDGES];
 
 uint GetBridgeFoundation(Slope tileh, Axis axis);
+uint GetBridgeHeightRamp(TileIndex t);
 
 #endif /* BRIDGE_H */
--- a/tunnelbridge_cmd.c	Fri Feb 09 11:13:03 2007 +0000
+++ b/tunnelbridge_cmd.c	Mon Feb 12 10:03:42 2007 +0000
@@ -611,7 +611,7 @@
 }
 
 
-static uint GetBridgeHeightRamp(TileIndex t)
+uint GetBridgeHeightRamp(TileIndex t)
 {
 	uint h;
 	uint tileh = GetTileSlope(t, &h);
--- a/water_cmd.c	Fri Feb 09 11:13:03 2007 +0000
+++ b/water_cmd.c	Mon Feb 12 10:03:42 2007 +0000
@@ -20,6 +20,7 @@
 #include "train.h"
 #include "water_map.h"
 #include "newgrf.h"
+#include "bridge.h"
 
 const SpriteID _water_shore_sprites[15] = {
 	0,
@@ -617,10 +618,10 @@
 	byte z;
 	Vehicle *v;
 
-	if (!IsBridgeTile(tile)) return FindVehicleOnTileZ(tile, 0);
+	if (!IsBridgeTile(tile) || !IsBridgeRamp(tile)) return FindVehicleOnTileZ(tile, 0);
 
 	end = GetOtherBridgeEnd(tile);
-	z = GetBridgeHeight(tile);
+	z = GetBridgeHeightRamp(tile);
 
 	/* check the start tile first since as this is closest to the water */
 	v = FindVehicleOnTileZ(tile, z);