mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-22 05:06:24 +00:00
refactor(Core/Misc): atan2() to std::atan2() (#9793)
- prefer std functions over C functions
This commit is contained in:
@@ -34,7 +34,7 @@
|
||||
auto dx = destX - startX;
|
||||
auto dy = destY - startY;
|
||||
|
||||
auto ang = atan2(dy, dx);
|
||||
auto ang = std::atan2(dy, dx);
|
||||
ang = (ang >= 0) ? ang : 2 * float(M_PI) + ang;
|
||||
return ang;
|
||||
}
|
||||
|
||||
@@ -2908,7 +2908,7 @@ Position WorldObject::GetFirstCollisionPosition(float startX, float startY, floa
|
||||
auto dx = destX - startX;
|
||||
auto dy = destY - startY;
|
||||
|
||||
auto ang = atan2(dy, dx);
|
||||
auto ang = std::atan2(dy, dx);
|
||||
ang = (ang >= 0) ? ang : 2 * M_PI + ang;
|
||||
Position pos = Position(startX, startY, startZ, ang);
|
||||
|
||||
@@ -2926,7 +2926,7 @@ Position WorldObject::GetFirstCollisionPosition(float destX, float destY, float
|
||||
auto dx = destX - pos.GetPositionX();
|
||||
auto dy = destY - pos.GetPositionY();
|
||||
|
||||
auto ang = atan2(dy, dx);
|
||||
auto ang = std::atan2(dy, dx);
|
||||
ang = (ang >= 0) ? ang : 2 * M_PI + ang;
|
||||
|
||||
MovePositionToFirstCollision(pos, distance, ang);
|
||||
|
||||
@@ -217,7 +217,7 @@ void MotionTransport::Update(uint32 diff)
|
||||
G3D::Vector3 pos, dir;
|
||||
_currentFrame->Spline->evaluate_percent(_currentFrame->Index, t, pos);
|
||||
_currentFrame->Spline->evaluate_derivative(_currentFrame->Index, t, dir);
|
||||
UpdatePosition(pos.x, pos.y, pos.z, NormalizeOrientation(atan2(dir.y, dir.x) + M_PI));
|
||||
UpdatePosition(pos.x, pos.y, pos.z, NormalizeOrientation(std::atan2(dir.y, dir.x) + M_PI));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -146,7 +146,7 @@ void TransportMgr::GeneratePath(GameObjectTemplate const* goInfo, TransportTempl
|
||||
KeyFrame k(node_i);
|
||||
G3D::Vector3 h;
|
||||
orientationSpline.evaluate_derivative(i + 1, 0.0f, h);
|
||||
k.InitialOrientation = Position::NormalizeOrientation(atan2(h.y, h.x) + M_PI);
|
||||
k.InitialOrientation = Position::NormalizeOrientation(std::atan2(h.y, h.x) + M_PI);
|
||||
|
||||
keyFrames.push_back(k);
|
||||
splinePath.push_back(G3D::Vector3(node_i->x, node_i->y, node_i->z));
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace Movement
|
||||
if (splineflags.final_angle)
|
||||
c.orientation = facing.angle;
|
||||
else if (splineflags.final_point)
|
||||
c.orientation = atan2(facing.f.y - c.y, facing.f.x - c.x);
|
||||
c.orientation = std::atan2(facing.f.y - c.y, facing.f.x - c.x);
|
||||
//nothing to do for MoveSplineFlag::Final_Target flag
|
||||
}
|
||||
else
|
||||
@@ -56,7 +56,7 @@ namespace Movement
|
||||
{
|
||||
Vector3 hermite;
|
||||
spline.evaluate_derivative(point_Idx, u, hermite);
|
||||
c.orientation = atan2(hermite.y, hermite.x);
|
||||
c.orientation = std::atan2(hermite.y, hermite.x);
|
||||
}
|
||||
|
||||
if (splineflags.orientationInversed)
|
||||
|
||||
Reference in New Issue
Block a user