Add: compile time "unit tests" for GetPartialZ consistent
This commit is contained in:
@@ -221,7 +221,7 @@ uint ApplyFoundationToSlope(Foundation f, Slope *s)
|
||||
* @param corners slope to examine
|
||||
* @return height of given point of given slope
|
||||
*/
|
||||
uint GetPartialPixelZ(int x, int y, Slope corners)
|
||||
static constexpr uint InternalGetPartialPixelZ(int x, int y, Slope corners)
|
||||
{
|
||||
if (IsHalftileSlope(corners)) {
|
||||
/* A foundation is placed on half the tile at a specific corner. This means that,
|
||||
@@ -285,6 +285,21 @@ uint GetPartialPixelZ(int x, int y, Slope corners)
|
||||
}
|
||||
}
|
||||
|
||||
#include "tests/landscape_partial_pixel_z.h"
|
||||
|
||||
/**
|
||||
* Determines height at given coordinate of a slope.
|
||||
* See #InternalGetPartialPixelZ.
|
||||
* @param x x coordinate (value from 0 to 15)
|
||||
* @param y y coordinate (value from 0 to 15)
|
||||
* @param corners slope to examine
|
||||
* @return height of given point of given slope
|
||||
*/
|
||||
uint GetPartialPixelZ(int x, int y, Slope corners)
|
||||
{
|
||||
return InternalGetPartialPixelZ(x, y, corners);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return world \c Z coordinate of a given point of a tile. Normally this is the
|
||||
* Z of the ground/foundation at the given location, but in some cases the
|
||||
|
Reference in New Issue
Block a user