summaryrefslogtreecommitdiff
path: root/vehicle.c
diff options
context:
space:
mode:
authorDarkvater <Darkvater@openttd.org>2006-01-22 17:17:11 +0000
committerDarkvater <Darkvater@openttd.org>2006-01-22 17:17:11 +0000
commitffb8c85b79ca7cf52fba1e90af69cc5e8de3283c (patch)
tree56c78e6816a7c40e9094049ccb97eacd760ce9c7 /vehicle.c
parentbea2d63154eb731859dfdd81818af789562ebcea (diff)
downloadopenttd-ffb8c85b79ca7cf52fba1e90af69cc5e8de3283c.tar.xz
(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.
Diffstat (limited to 'vehicle.c')
-rw-r--r--vehicle.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/vehicle.c b/vehicle.c
index 8e3111552..bd69f6c95 100644
--- a/vehicle.c
+++ b/vehicle.c
@@ -128,8 +128,8 @@ static void *EnsureNoVehicleProcZ(Vehicle *v, void *data)
{
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 @@ bool EnsureNoVehicleZ(TileIndex tile, byte z)
{
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;
}