summaryrefslogtreecommitdiff
path: root/tunnelbridge_cmd.c
diff options
context:
space:
mode:
authortron <tron@openttd.org>2005-03-27 16:40:01 +0000
committertron <tron@openttd.org>2005-03-27 16:40:01 +0000
commitc4133f253547351734b4186b7a2d411553fde3a5 (patch)
tree0826e3587b7feab43062f5ba706f5d249581367e /tunnelbridge_cmd.c
parent31c36d3dd4a75eec1a548ef6e66c8c4bac82d3f6 (diff)
downloadopenttd-c4133f253547351734b4186b7a2d411553fde3a5.tar.xz
(svn r2091) Small cleanup: uint -> TileIndex, const, don't call FindLandscapeHeightByTile()
Diffstat (limited to 'tunnelbridge_cmd.c')
-rw-r--r--tunnelbridge_cmd.c21
1 files changed, 7 insertions, 14 deletions
diff --git a/tunnelbridge_cmd.c b/tunnelbridge_cmd.c
index 512b29069..402d25f76 100644
--- a/tunnelbridge_cmd.c
+++ b/tunnelbridge_cmd.c
@@ -1498,23 +1498,16 @@ static uint32 VehicleEnter_TunnelBridge(Vehicle *v, uint tile, int x, int y)
return 0;
}
-uint GetVehicleOutOfTunnelTile(Vehicle *v)
+TileIndex GetVehicleOutOfTunnelTile(const Vehicle *v)
{
- uint tile = v->tile;
- int delta_tile;
- byte z;
+ TileIndex tile;
+ TileIndexDiff delta = (v->direction & 2) ? TILE_XY(0, 1) : TILE_XY(1, 0);
+ byte z = v->z_pos;
- /* locate either ending of the tunnel */
- delta_tile = (v->direction&2) ? TILE_XY(0,1) : TILE_XY(1,0);
- z = v->z_pos;
- for(;;) {
- TileInfo ti;
- FindLandscapeHeightByTile(&ti, tile);
-
- if (ti.type == MP_TUNNELBRIDGE && (ti.map5 & 0xF0)==0 && (byte)ti.z == z)
+ for (tile = v->tile;; tile += delta) {
+ if (IsTileType(tile, MP_TUNNELBRIDGE) && (_map5[tile] & 0xF0) == 0 &&
+ GetTileZ(tile) == z)
break;
-
- tile += delta_tile;
}
return tile;
}