diff options
author | darkvater <darkvater@openttd.org> | 2005-01-21 19:52:32 +0000 |
---|---|---|
committer | darkvater <darkvater@openttd.org> | 2005-01-21 19:52:32 +0000 |
commit | 0d43eb3ab8a1e42f53772480eb94493b97177a8e (patch) | |
tree | 0aa97722ee76d847689d945b957ecc279f9e5699 /vehicle.c | |
parent | cbe9939c86e3e8ab297389e582b19746f85efa20 (diff) | |
download | openttd-0d43eb3ab8a1e42f53772480eb94493b97177a8e.tar.xz |
(svn r1583) -Fix: You should no longer be able to delete bridges on any type of underground when there is a vehicle on it
Diffstat (limited to 'vehicle.c')
-rw-r--r-- | vehicle.c | 22 |
1 files changed, 16 insertions, 6 deletions
@@ -73,17 +73,27 @@ static void *EnsureNoVehicleProcZ(Vehicle *v, void *data) return v; } -bool EnsureNoVehicleZ(TileIndex tile, byte z) +static inline uint Correct_Z(uint tileh) +{ + // needs z correction for slope-type graphics that have the NORTHERN tile lowered + // 1, 2, 3, 4, 5, 6 and 7 + return (CORRECT_Z(tileh)) ? 8 : 0; +} + +uint GetCorrectTileHeight(TileIndex tile) { TileInfo ti; FindLandscapeHeightByTile(&ti, tile); - // needs z correction for slope-type graphics that have the NORTHERN tile lowered - // 1, 2, 3, 4, 5, 6 and 7 - if (CORRECT_Z(ti.tileh)) - z += 8; + return Correct_Z(ti.tileh); +} - ti.z = z; +bool EnsureNoVehicleZ(TileIndex tile, byte z) +{ + TileInfo ti; + + FindLandscapeHeightByTile(&ti, tile); + ti.z = z + Correct_Z(ti.tileh); return VehicleFromPos(tile, &ti, EnsureNoVehicleProcZ) == NULL; } |