diff options
author | rubidium <rubidium@openttd.org> | 2011-11-04 10:20:24 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2011-11-04 10:20:24 +0000 |
commit | a36551dbb4a6aa8a10e99df8331ac4ecb8586270 (patch) | |
tree | f63714ceff46343e77309a9084758de39ca52b9b /src/slope_func.h | |
parent | 7757a2ed406996be35c7179185f2e4e7cba37e12 (diff) | |
download | openttd-a36551dbb4a6aa8a10e99df8331ac4ecb8586270.tar.xz |
(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
Diffstat (limited to 'src/slope_func.h')
-rw-r--r-- | src/slope_func.h | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/slope_func.h b/src/slope_func.h index c36c89efd..d231a4d08 100644 --- a/src/slope_func.h +++ b/src/slope_func.h @@ -159,11 +159,22 @@ static inline Corner GetHalftileSlopeCorner(Slope s) * @param s The #Slope. * @return Relative height of highest corner. */ -static inline uint GetSlopeMaxPixelZ(Slope s) +static inline uint GetSlopeMaxZ(Slope s) { if (s == SLOPE_FLAT) return 0; - if (IsSteepSlope(s)) return 2 * TILE_HEIGHT; - return TILE_HEIGHT; + if (IsSteepSlope(s)) return 2; + return 1; +} + +/** + * Returns the height of the highest corner of a slope relative to TileZ (= minimal height) + * + * @param s The #Slope. + * @return Relative height of highest corner. + */ +static inline uint GetSlopeMaxPixelZ(Slope s) +{ + return GetSlopeMaxZ(s) * TILE_HEIGHT; } /** |