summaryrefslogtreecommitdiff
path: root/train_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 /train_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 'train_cmd.c')
-rw-r--r--train_cmd.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/train_cmd.c b/train_cmd.c
index a4ae5d61e..a9d5950b1 100644
--- a/train_cmd.c
+++ b/train_cmd.c
@@ -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;