Namespace qualify std::abs, use explicit cast
Without 'std' namespace qualification Clang (at least Apple Clang 6.1) seems to resolve 'abs' to the 'abs' function in 'cstdlib'. This in turn triggers the 'absolute-value' warning which in turn is promoted to error. Implicit casts trigger 'old-style-cast' warnings which are promoted to errors.
This commit is contained in:
parent
a341419b04
commit
12fb95ba2f
@ -2124,7 +2124,7 @@ void cPlayer::UpdateMovementStats(const Vector3d & a_DeltaPos, bool a_PreviousIs
|
||||
else if (a_DeltaPos.y < 0.0)
|
||||
{
|
||||
// Increment statistic
|
||||
m_Stats.AddValue(statDistFallen, (StatValue)(abs(a_DeltaPos.y) * 100 + 0.5));
|
||||
m_Stats.AddValue(statDistFallen, static_cast<StatValue>(std::abs(a_DeltaPos.y) * 100 + 0.5));
|
||||
}
|
||||
// TODO: good opportunity to detect illegal flight (check for falling tho)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user