mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-19 11:55:43 +00:00
refactor(Core/Misc): fabs() to std::fabs() (#9790)
- prefer std functions over C functions
This commit is contained in:
@@ -562,7 +562,7 @@ void MotionMaster::MoveFall(uint32 id /*=0*/, bool addFlagForNPC)
|
||||
}
|
||||
|
||||
// Abort too if the ground is very near
|
||||
if (fabs(_owner->GetPositionZ() - tz) < 0.1f)
|
||||
if (std::fabs(_owner->GetPositionZ() - tz) < 0.1f)
|
||||
return;
|
||||
|
||||
if (_owner->GetTypeId() == TYPEID_PLAYER)
|
||||
|
||||
@@ -52,7 +52,7 @@ void ConfusedMovementGenerator<T>::DoInitialize(T* unit)
|
||||
Acore::NormalizeMapCoord(wanderY);
|
||||
|
||||
float new_z = unit->GetMapHeight(wanderX, wanderY, z);
|
||||
if (new_z <= INVALID_HEIGHT || fabs(z - new_z) > 3.0f) // pussywizard
|
||||
if (new_z <= INVALID_HEIGHT || std::fabs(z - new_z) > 3.0f) // pussywizard
|
||||
{
|
||||
i_waypoints[idx][0] = idx > 0 ? i_waypoints[idx - 1][0] : x;
|
||||
i_waypoints[idx][1] = idx > 0 ? i_waypoints[idx - 1][1] : y;
|
||||
|
||||
@@ -160,11 +160,11 @@ bool FleeingMovementGenerator<T>::_getPoint(T* owner, float& x, float& y, float&
|
||||
break;
|
||||
}
|
||||
|
||||
if (!(temp_z - z) || distance / fabs(temp_z - z) > 1.0f)
|
||||
if (!(temp_z - z) || distance / std::fabs(temp_z - z) > 1.0f)
|
||||
{
|
||||
float temp_z_left = _map->GetHeight(owner->GetPhaseMask(), temp_x + 1.0f * cos(angle + static_cast<float>(M_PI / 2)), temp_y + 1.0f * sin(angle + static_cast<float>(M_PI / 2)), z, true);
|
||||
float temp_z_right = _map->GetHeight(owner->GetPhaseMask(), temp_x + 1.0f * cos(angle - static_cast<float>(M_PI / 2)), temp_y + 1.0f * sin(angle - static_cast<float>(M_PI / 2)), z, true);
|
||||
if (fabs(temp_z_left - temp_z) < 1.2f && fabs(temp_z_right - temp_z) < 1.2f)
|
||||
if (std::fabs(temp_z_left - temp_z) < 1.2f && std::fabs(temp_z_right - temp_z) < 1.2f)
|
||||
{
|
||||
// use new values
|
||||
x = temp_x;
|
||||
|
||||
@@ -154,7 +154,7 @@ void RandomMovementGenerator<Creature>::_setRandomLocation(Creature* creature)
|
||||
for (; itrNext != finalPath.end(); ++itr, ++itrNext)
|
||||
{
|
||||
distDiff = sqrt(((*itr).x - (*itrNext).x) * ((*itr).x - (*itrNext).x) + ((*itr).y - (*itrNext).y) * ((*itr).y - (*itrNext).y));
|
||||
zDiff = fabs((*itr).z - (*itrNext).z);
|
||||
zDiff = std::fabs((*itr).z - (*itrNext).z);
|
||||
|
||||
// Xinef: tree climbing, cut as much as we can
|
||||
if (zDiff > 2.0f ||
|
||||
|
||||
@@ -227,7 +227,7 @@ namespace Movement
|
||||
for (uint32 i = 1; i < path.size() - 1; ++i)
|
||||
{
|
||||
offset = path[i] - middle;
|
||||
if (fabs(offset.x) >= MAX_OFFSET || fabs(offset.y) >= MAX_OFFSET || fabs(offset.z) >= MAX_OFFSET)
|
||||
if (std::fabs(offset.x) >= MAX_OFFSET || std::fabs(offset.y) >= MAX_OFFSET || std::fabs(offset.z) >= MAX_OFFSET)
|
||||
{
|
||||
LOG_ERROR("movement", "MoveSplineInitArgs::_checkPathBounds check failed");
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user