(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

This commit is contained in:
tron
2006-05-07 07:55:05 +00:00
parent 4f092c8de8
commit 5622ad4b5e
6 changed files with 26 additions and 20 deletions

View File

@@ -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 */