summaryrefslogtreecommitdiff
path: root/tunnelbridge_cmd.c
diff options
context:
space:
mode:
authortron <tron@openttd.org>2006-05-07 07:55:05 +0000
committertron <tron@openttd.org>2006-05-07 07:55:05 +0000
commit5622ad4b5efdba60db4bcfaf03ba358c569064f6 (patch)
treef5113d4060c886372d1bca9edc9098d07a6dc3e0 /tunnelbridge_cmd.c
parent4f092c8de8e30ce4d29165a7d46dd2203c887722 (diff)
downloadopenttd-5622ad4b5efdba60db4bcfaf03ba358c569064f6.tar.xz
(svn r4765) Add GetTileMaxZ(), which returns the height of the highest corner of a tile, and use it to simplify the code in a few places
Diffstat (limited to 'tunnelbridge_cmd.c')
-rw-r--r--tunnelbridge_cmd.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/tunnelbridge_cmd.c b/tunnelbridge_cmd.c
index 503616e67..aca77e9e1 100644
--- a/tunnelbridge_cmd.c
+++ b/tunnelbridge_cmd.c
@@ -1357,10 +1357,8 @@ static uint32 VehicleEnter_TunnelBridge(Vehicle *v, TileIndex tile, int x, int y
}
} else if (IsBridge(tile)) { // XXX is this necessary?
if (v->type == VEH_Road || (v->type == VEH_Train && IsFrontEngine(v))) {
- uint h;
+ uint h = GetTileMaxZ(tile);
- // Compensate for possible foundation
- if (GetTileSlope(tile, &h) != SLOPE_FLAT) h += TILE_HEIGHT;
if (IsBridgeRamp(tile) ||
myabs(h - v->z_pos) > 2) { // high above the ground -> on the bridge
/* modify speed of vehicle */