Increase default padding to 1 in GetClampedCoords to avoid overflow msg.

This commit is contained in:
Alex 2022-12-08 03:57:11 +03:00
parent 9a5df73060
commit 36ee9f72e2
1 changed files with 3 additions and 3 deletions

View File

@ -134,9 +134,9 @@ VECTOR2<T> GetVectorSnapped45( const VECTOR2<T>& aVec, bool only45 = false )
/**
* Clamps a vector to values that can be negated, respecting numeric limits
* of coordinates data type with specified padding.
*
*
* Numeric limits are (-2^31 + 1) to (2^31 - 1).
*
*
* Takes care of rounding in case of floating point to integer conversion.
*
* @param aCoord - vector to clamp.
@ -145,7 +145,7 @@ VECTOR2<T> GetVectorSnapped45( const VECTOR2<T>& aVec, bool only45 = false )
*/
template <typename in_type, typename ret_type = in_type, typename pad_type = unsigned int,
typename = typename std::enable_if<std::is_unsigned<pad_type>::value>::type>
VECTOR2<ret_type> GetClampedCoords( const VECTOR2<in_type>& aCoords, pad_type aPadding = 0u )
VECTOR2<ret_type> GetClampedCoords( const VECTOR2<in_type>& aCoords, pad_type aPadding = 1u )
{
typedef std::numeric_limits<int> coord_limits;