(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

@@ -2623,13 +2623,8 @@ static bool CheckCompatibleRail(const Vehicle *v, TileIndex tile)
case MP_TUNNELBRIDGE:
if (IsBridge(tile) && IsBridgeMiddle(tile)) {
uint height;
Slope tileh = GetTileSlope(tile, &height);
// correct Z position of a train going under a bridge on slopes
if (tileh != SLOPE_FLAT) height += TILE_HEIGHT;
if (v->z_pos > height) return true; // train is going over bridge
// is train going over the bridge?
if (v->z_pos > GetTileMaxZ(tile)) return true;
}
break;