(svn r1696) Use GetTileSlope() instead of FindLandscapeHeightByTile() where it is sufficient. FindLandscapeHeightByTile() uses GetTileSlope() internally and adds some more info, which is discarded in these cases.

While touching the code make a bit more clear how GetBridgeHeight() works.
This commit is contained in:
tron
2005-01-27 12:52:20 +00:00
parent 697b619ac1
commit 372b9cb827
3 changed files with 10 additions and 19 deletions

View File

@@ -2049,13 +2049,13 @@ static bool CheckCompatibleRail(const Vehicle *v, TileIndex tile)
case MP_TUNNELBRIDGE:
if ((_map5[tile] & 0xC0) == 0xC0) { // is bridge middle part?
TileInfo ti;
FindLandscapeHeightByTile(&ti, tile);
uint height;
uint tileh = GetTileSlope(tile, &height);
// correct Z position of a train going under a bridge on slopes
if (CORRECT_Z(ti.tileh)) ti.z += 8;
if (CORRECT_Z(tileh)) height += 8;
if (v->z_pos != ti.z) return true; // train is going over bridge
if (v->z_pos != height) return true; // train is going over bridge
}
break;