summaryrefslogtreecommitdiff
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
commitc6b211d0aa91b8320bb55c0197d7388f140226a0 (patch)
tree0826e3587b7feab43062f5ba706f5d249581367e
parent6552c22785daba8cf8082dd065749f35cf05dcca (diff)
downloadopenttd-c6b211d0aa91b8320bb55c0197d7388f140226a0.tar.xz
(svn r2091) Small cleanup: uint -> TileIndex, const, don't call FindLandscapeHeightByTile()
-rw-r--r--tunnelbridge_cmd.c21
-rw-r--r--vehicle.h2
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);