From c6b211d0aa91b8320bb55c0197d7388f140226a0 Mon Sep 17 00:00:00 2001 From: tron Date: Sun, 27 Mar 2005 16:40:01 +0000 Subject: (svn r2091) Small cleanup: uint -> TileIndex, const, don't call FindLandscapeHeightByTile() --- tunnelbridge_cmd.c | 21 +++++++-------------- vehicle.h | 2 +- 2 files changed, 8 insertions(+), 15 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; } diff --git a/vehicle.h b/vehicle.h index b7344f35f..2eb585c66 100644 --- a/vehicle.h +++ b/vehicle.h @@ -282,7 +282,7 @@ uint32 VehicleEnterTile(Vehicle *v, uint tile, int x, int y); void VehicleInTheWayErrMsg(Vehicle *v); Vehicle *FindVehicleBetween(TileIndex from, TileIndex to, byte z); -uint GetVehicleOutOfTunnelTile(Vehicle *v); +TileIndex GetVehicleOutOfTunnelTile(const Vehicle *v); bool UpdateSignalsOnSegment(uint tile, byte direction); void SetSignalsOnBothDir(uint tile, byte track); -- cgit v1.2.3-54-g00ecf