diff --git a/common/Platform.h b/common/Platform.h index f07654831..386fd3723 100644 --- a/common/Platform.h +++ b/common/Platform.h @@ -77,4 +77,5 @@ using qboolean = int; #define V_min(a, b) (((a) < (b)) ? (a) : (b)) #define V_max(a, b) (((a) > (b)) ? (a) : (b)) -#define clamp(val, min, max) (((val) > (max)) ? (max) : (((val) < (min)) ? (min) : (val))) +// Clamp macro is deprecated. Use std::clamp instead. +// #define clamp(val, min, max) (((val) > (max)) ? (max) : (((val) < (min)) ? (min) : (val))) diff --git a/dlls/player.cpp b/dlls/player.cpp index 28fd00a5f..d6889a77a 100644 --- a/dlls/player.cpp +++ b/dlls/player.cpp @@ -21,6 +21,7 @@ */ #include +#include #include "extdll.h" #include "util.h" @@ -3904,7 +3905,7 @@ void CBasePlayer::UpdateClientData() if (pev->health != m_iClientHealth) { - int iHealth = clamp(pev->health, 0, std::numeric_limits::max()); // make sure that no negative health values are sent + int iHealth = std::clamp(pev->health, 0.f, (float)(std::numeric_limits::max())); // make sure that no negative health values are sent if (pev->health > 0.0f && pev->health <= 1.0f) iHealth = 1;