@ -590,7 +590,7 @@ bool PlrHitMonst(Player &player, Monster &monster, bool adjacentDamage = false)
}
hper + = player . GetMeleePiercingToHit ( ) - player . CalculateArmorPierce ( monster . armorClass , true ) ;
hper = clamp ( hper , 5 , 95 ) ;
hper = std : : clamp ( hper , 5 , 95 ) ;
if ( monster . tryLiftGargoyle ( ) )
return true ;
@ -754,7 +754,7 @@ bool PlrHitPlr(Player &attacker, Player &target)
int hit = GenerateRnd ( 100 ) ;
int hper = attacker . GetMeleeToHit ( ) - target . GetArmor ( ) ;
hper = clamp ( hper , 5 , 95 ) ;
hper = std : : clamp ( hper , 5 , 95 ) ;
int blk = 100 ;
if ( ( target . _pmode = = PM_STAND | | target . _pmode = = PM_ATTACK ) & & target . _pBlockFlag ) {
@ -762,7 +762,7 @@ bool PlrHitPlr(Player &attacker, Player &target)
}
int blkper = target . GetBlockChance ( ) - ( attacker . _pLevel * 2 ) ;
blkper = clamp ( blkper , 0 , 100 ) ;
blkper = std : : clamp ( blkper , 0 , 100 ) ;
if ( hit > = hper ) {
return false ;
@ -2193,7 +2193,7 @@ void NewPlrAnim(Player &player, player_graphic graphic, Direction dir, Animation
if ( ! HeadlessMode ) {
sprites = player . AnimationData [ static_cast < size_t > ( graphic ) ] . spritesForDirection ( dir ) ;
if ( player . previewCelSprite & & ( * sprites ) [ 0 ] = = * player . previewCelSprite & & ! player . isWalking ( ) ) {
previewShownGameTickFragments = clamp < int > ( AnimationInfo : : baseValueFraction - player . progressToNextGameTickWhenPreviewWasSet , 0 , AnimationInfo : : baseValueFraction ) ;
previewShownGameTickFragments = std : : clamp < int > ( AnimationInfo : : baseValueFraction - player . progressToNextGameTickWhenPreviewWasSet , 0 , AnimationInfo : : baseValueFraction ) ;
}
}
@ -2447,7 +2447,7 @@ void AddPlrExperience(Player &player, int lvl, int exp)
// Prevent power leveling
if ( gbIsMultiplayer ) {
const uint32_t clampedPlayerLevel = clamp ( static_cast < int > ( player . _pLevel ) , 1 , MaxCharacterLevel ) ;
const uint32_t clampedPlayerLevel = std : : clamp ( static_cast < int > ( player . _pLevel ) , 1 , MaxCharacterLevel ) ;
// for low level characters experience gain is capped to 1/20 of current levels xp
// for high level characters experience gain is capped to 200 * current level - this is a smaller value than 1/20 of the exp needed for the next level after level 5.
@ -3303,16 +3303,16 @@ void CheckStats(Player &player)
int maxStatPoint = player . GetMaximumAttributeValue ( attribute ) ;
switch ( attribute ) {
case CharacterAttribute : : Strength :
player . _pBaseStr = clamp ( player . _pBaseStr , 0 , maxStatPoint ) ;
player . _pBaseStr = std : : clamp ( player . _pBaseStr , 0 , maxStatPoint ) ;
break ;
case CharacterAttribute : : Magic :
player . _pBaseMag = clamp ( player . _pBaseMag , 0 , maxStatPoint ) ;
player . _pBaseMag = std : : clamp ( player . _pBaseMag , 0 , maxStatPoint ) ;
break ;
case CharacterAttribute : : Dexterity :
player . _pBaseDex = clamp ( player . _pBaseDex , 0 , maxStatPoint ) ;
player . _pBaseDex = std : : clamp ( player . _pBaseDex , 0 , maxStatPoint ) ;
break ;
case CharacterAttribute : : Vitality :
player . _pBaseVit = clamp ( player . _pBaseVit , 0 , maxStatPoint ) ;
player . _pBaseVit = std : : clamp ( player . _pBaseVit , 0 , maxStatPoint ) ;
break ;
}
}
@ -3320,7 +3320,7 @@ void CheckStats(Player &player)
void ModifyPlrStr ( Player & player , int l )
{
l = clamp ( l , 0 - player . _pBaseStr , player . GetMaximumAttributeValue ( CharacterAttribute : : Strength ) - player . _pBaseStr ) ;
l = std : : clamp ( l , 0 - player . _pBaseStr , player . GetMaximumAttributeValue ( CharacterAttribute : : Strength ) - player . _pBaseStr ) ;
player . _pStrength + = l ;
player . _pBaseStr + = l ;
@ -3334,7 +3334,7 @@ void ModifyPlrStr(Player &player, int l)
void ModifyPlrMag ( Player & player , int l )
{
l = clamp ( l , 0 - player . _pBaseMag , player . GetMaximumAttributeValue ( CharacterAttribute : : Magic ) - player . _pBaseMag ) ;
l = std : : clamp ( l , 0 - player . _pBaseMag , player . GetMaximumAttributeValue ( CharacterAttribute : : Magic ) - player . _pBaseMag ) ;
player . _pMagic + = l ;
player . _pBaseMag + = l ;
@ -3358,7 +3358,7 @@ void ModifyPlrMag(Player &player, int l)
void ModifyPlrDex ( Player & player , int l )
{
l = clamp ( l , 0 - player . _pBaseDex , player . GetMaximumAttributeValue ( CharacterAttribute : : Dexterity ) - player . _pBaseDex ) ;
l = std : : clamp ( l , 0 - player . _pBaseDex , player . GetMaximumAttributeValue ( CharacterAttribute : : Dexterity ) - player . _pBaseDex ) ;
player . _pDexterity + = l ;
player . _pBaseDex + = l ;
@ -3371,7 +3371,7 @@ void ModifyPlrDex(Player &player, int l)
void ModifyPlrVit ( Player & player , int l )
{
l = clamp ( l , 0 - player . _pBaseVit , player . GetMaximumAttributeValue ( CharacterAttribute : : Vitality ) - player . _pBaseVit ) ;
l = std : : clamp ( l , 0 - player . _pBaseVit , player . GetMaximumAttributeValue ( CharacterAttribute : : Vitality ) - player . _pBaseVit ) ;
player . _pVitality + = l ;
player . _pBaseVit + = l ;