(svn r3419) - Fix: [FS#40] (Possible) game crash on removing track/road under bridge. This was caused by a wrong tile-occupancy testing where it was assumed that a vehicle's height is only a multitude of 8 (a single height-difference). This is incorrect as a vehicle on a slope will assume all height levels between the lower-and upper-bounds. The crash is still possible as seen in the Flyspray bugreport but this has a different cause.
authorDarkvater
Sun, 22 Jan 2006 17:17:11 +0000
changeset 2871 66b55a022d12
parent 2870 32c980d2b8e9
child 2872 ae5d9dbf8402
(svn r3419) - Fix: [FS#40] (Possible) game crash on removing track/road under bridge. This was caused by a wrong tile-occupancy testing where it was assumed that a vehicle's height is only a multitude of 8 (a single height-difference). This is incorrect as a vehicle on a slope will assume all height levels between the lower-and upper-bounds. The crash is still possible as seen in the Flyspray bugreport but this has a different cause.
vehicle.c
--- a/vehicle.c	Sun Jan 22 16:23:05 2006 +0000
+++ b/vehicle.c	Sun Jan 22 17:17:11 2006 +0000
@@ -128,8 +128,8 @@
 {
 	const TileInfo *ti = data;
 
-	if (v->tile != ti->tile || v->z_pos != ti->z || v->type == VEH_Disaster)
-		return NULL;
+	if (v->tile != ti->tile || v->type == VEH_Disaster) return NULL;
+	if (v->z_pos != ti->z && abs(ti->z - v->z_pos) >= 8) return NULL;
 
 	VehicleInTheWayErrMsg(v);
 	return v;
@@ -151,8 +151,8 @@
 {
 	TileInfo ti;
 
-	FindLandscapeHeightByTile(&ti, tile);
-	ti.z = z + Correct_Z(ti.tileh);
+	ti.tile = tile;
+	ti.z = z + GetCorrectTileHeight(tile);
 
 	return VehicleFromPos(tile, &ti, EnsureNoVehicleProcZ) == NULL;
 }