(svn r23092) -Codechange: create a non-pixel version of some of the Get*PixelZ functions, and let Get*PixelZ wrap around the new function (multiplying the Z by TILE_HEIGHT) just like TileHeight and TilePixelHeight

This commit is contained in:
rubidium
2011-11-04 10:20:24 +00:00
parent 7757a2ed40
commit a36551dbb4
7 changed files with 126 additions and 30 deletions

View File

@@ -18,13 +18,13 @@
* @param h If not \c NULL, pointer to storage of z height
* @return Slope of the tile, except for the HALFTILE part
*/
Slope GetTilePixelSlope(TileIndex tile, uint *h)
Slope GetTileSlope(TileIndex tile, uint *h)
{
assert(tile < MapSize());
if (TileX(tile) == MapMaxX() || TileY(tile) == MapMaxY() ||
(_settings_game.construction.freeform_edges && (TileX(tile) == 0 || TileY(tile) == 0))) {
if (h != NULL) *h = TileHeight(tile) * TILE_HEIGHT;
if (h != NULL) *h = TileHeight(tile);
return SLOPE_FLAT;
}
@@ -54,7 +54,7 @@ Slope GetTilePixelSlope(TileIndex tile, uint *h)
if ((d -= min) != 0) r += (--d << 4) + SLOPE_S;
if ((b -= min) != 0) r += (--b << 4) + SLOPE_W;
if (h != NULL) *h = min * TILE_HEIGHT;
if (h != NULL) *h = min;
return (Slope)r;
}
@@ -64,7 +64,7 @@ Slope GetTilePixelSlope(TileIndex tile, uint *h)
* @param tile Tile to compute height of
* @return Minimum height of the tile
*/
uint GetTilePixelZ(TileIndex tile)
uint GetTileZ(TileIndex tile)
{
if (TileX(tile) == MapMaxX() || TileY(tile) == MapMaxY()) return 0;
@@ -73,7 +73,7 @@ uint GetTilePixelZ(TileIndex tile)
h = min(h, TileHeight(tile + TileDiffXY(0, 1))); // E corner
h = min(h, TileHeight(tile + TileDiffXY(1, 1))); // S corner
return h * TILE_HEIGHT;
return h;
}
/**
@@ -81,7 +81,7 @@ uint GetTilePixelZ(TileIndex tile)
* @param t Tile to compute height of
* @return Maximum height of the tile
*/
uint GetTileMaxPixelZ(TileIndex t)
uint GetTileMaxZ(TileIndex t)
{
if (TileX(t) == MapMaxX() || TileY(t) == MapMaxY()) return 0;
@@ -90,5 +90,5 @@ uint GetTileMaxPixelZ(TileIndex t)
h = max(h, TileHeight(t + TileDiffXY(0, 1))); // E corner
h = max(h, TileHeight(t + TileDiffXY(1, 1))); // S corner
return h * TILE_HEIGHT;
return h;
}