summaryrefslogtreecommitdiff
path: root/train_cmd.c
diff options
context:
space:
mode:
authortron <tron@openttd.org>2005-01-27 12:52:20 +0000
committertron <tron@openttd.org>2005-01-27 12:52:20 +0000
commit63653bd6aff20948868d9d6cf01d00e3a8c31d8f (patch)
tree3d5f382fb85ba8444b4f6b8788fddbaa84031924 /train_cmd.c
parent6eec07257a86cb23f1b4efc11e184dff100a452e (diff)
downloadopenttd-63653bd6aff20948868d9d6cf01d00e3a8c31d8f.tar.xz
(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.
Diffstat (limited to 'train_cmd.c')
-rw-r--r--train_cmd.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/train_cmd.c b/train_cmd.c
index 5853116b1..1ce1631ee 100644
--- a/train_cmd.c
+++ b/train_cmd.c
@@ -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;