Add: compile time "unit tests" for GetPartialZ consistent

This commit is contained in:
Rubidium
2023-02-25 23:58:46 +01:00
committed by rubidium42
parent 41ef7c88af
commit c6ff7dad68
4 changed files with 572 additions and 1 deletions

View File

@@ -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