@@ -184,63 +184,27 @@ int GetTileZ(TileIndex tile)
{
if (TileX(tile) == MapMaxX() || TileY(tile) == MapMaxY()) return 0;
int h = TileHeight(tile); // N corner
h = min(h, TileHeight(tile + TileDiffXY(1, 0))); // W corner
h = min(h, TileHeight(tile + TileDiffXY(0, 1))); // E corner
h = min(h, TileHeight(tile + TileDiffXY(1, 1))); // S corner
return h;
}
/**
* Get bottom height of the tile outside map.
*
* @param x X-coordinate of the tile outside to compute height of.
* @param y Y-coordinate of the tile outside to compute height of.
* @return Minimum height of the tile outside the map.
*/
int GetTilePixelZOutsideMap(int x, int y)
uint h = TileHeightOutsideMap(x, y); // N corner.
h = min(h, TileHeightOutsideMap(x + 1, y)); // W corner.
h = min(h, TileHeightOutsideMap(x, y + 1)); // E corner.
h = min(h, TileHeightOutsideMap(x + 1, y + 1)); // S corner
return h * TILE_HEIGHT;
* Get top height of the tile inside the map.
* @param t Tile to compute height of
* @return Maximum height of the tile
int GetTileMaxZ(TileIndex t)
if (TileX(t) == MapMaxX() || TileY(t) == MapMaxY()) return TileHeightOutsideMap(TileX(t), TileY(t));
int h = TileHeight(t); // N corner
h = max<int>(h, TileHeight(t + TileDiffXY(1, 0))); // W corner
h = max<int>(h, TileHeight(t + TileDiffXY(0, 1))); // E corner
h = max<int>(h, TileHeight(t + TileDiffXY(1, 1))); // S corner
* Get top height of the tile outside the map.
* @see Detailed description in header.
* @return Maximum height of the tile.
int GetTileMaxPixelZOutsideMap(int x, int y)
uint h = TileHeightOutsideMap(x, y);
h = max(h, TileHeightOutsideMap(x + 1, y));
h = max(h, TileHeightOutsideMap(x, y + 1));
h = max(h, TileHeightOutsideMap(x + 1, y + 1));
@@ -280,39 +280,34 @@ static inline Slope GetTilePixelSlope(Ti
Slope GetTilePixelSlopeOutsideMap(int x, int y, int *h);
* Get bottom height of the tile
* @param tile Tile to compute height of
* @return Minimum height of the tile
static inline int GetTilePixelZ(TileIndex tile)
return GetTileZ(tile) * TILE_HEIGHT;
int GetTilePixelZOutsideMap(int x, int y);
* Get top height of the tile
static inline int GetTileMaxPixelZ(TileIndex tile)
return GetTileMaxZ(tile) * TILE_HEIGHT;
int GetTileMaxPixelZOutsideMap(int x, int y);
* Calculate a hash value from a tile position
* @param x The X coordinate
* @param y The Y coordinate
* @return The hash of the tile
static inline uint TileHash(uint x, uint y)
uint hash = x >> 4;
hash ^= x >> 6;
hash ^= y >> 4;
Status change: