mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-24 22:26:22 +00:00
refactor(Core/Misc): sin() to std::sin() (#9795)
This commit is contained in:
@@ -1514,7 +1514,7 @@ void GameObject::Use(Unit* user)
|
||||
float relativeDistance = (info->size * itr->first) - (info->size * (info->chair.slots - 1) / 2.0f);
|
||||
|
||||
float x_i = GetPositionX() + relativeDistance * cos(orthogonalOrientation);
|
||||
float y_i = GetPositionY() + relativeDistance * sin(orthogonalOrientation);
|
||||
float y_i = GetPositionY() + relativeDistance * std::sin(orthogonalOrientation);
|
||||
|
||||
if (itr->second)
|
||||
{
|
||||
@@ -2082,7 +2082,7 @@ bool GameObject::IsInRange(float x, float y, float z, float radius) const
|
||||
if (!info)
|
||||
return IsWithinDist3d(x, y, z, radius);
|
||||
|
||||
float sinA = sin(GetOrientation());
|
||||
float sinA = std::sin(GetOrientation());
|
||||
float cosA = cos(GetOrientation());
|
||||
float dx = x - GetPositionX();
|
||||
float dy = y - GetPositionY();
|
||||
|
||||
@@ -1022,7 +1022,8 @@ bool Position::HasInLine(WorldObject const* target, float width) const
|
||||
return false;
|
||||
width += target->GetObjectSize();
|
||||
float angle = GetRelativeAngle(target);
|
||||
return std::fabs(sin(angle)) * GetExactDist2d(target->GetPositionX(), target->GetPositionY()) < width;
|
||||
|
||||
return std::fabs(std::sin(angle)) * GetExactDist2d(target->GetPositionX(), target->GetPositionY()) < width;
|
||||
}
|
||||
|
||||
std::string Position::ToString() const
|
||||
@@ -1519,8 +1520,8 @@ bool WorldObject::IsInRange3d(float x, float y, float z, float minRange, float m
|
||||
|
||||
void Position::RelocateOffset(const Position& offset)
|
||||
{
|
||||
m_positionX = GetPositionX() + (offset.GetPositionX() * cos(GetOrientation()) + offset.GetPositionY() * sin(GetOrientation() + M_PI));
|
||||
m_positionY = GetPositionY() + (offset.GetPositionY() * cos(GetOrientation()) + offset.GetPositionX() * sin(GetOrientation()));
|
||||
m_positionX = GetPositionX() + (offset.GetPositionX() * cos(GetOrientation()) + offset.GetPositionY() * std::sin(GetOrientation() + M_PI));
|
||||
m_positionY = GetPositionY() + (offset.GetPositionY() * cos(GetOrientation()) + offset.GetPositionX() * std::sin(GetOrientation()));
|
||||
m_positionZ = GetPositionZ() + offset.GetPositionZ();
|
||||
m_orientation = GetOrientation() + offset.GetOrientation();
|
||||
}
|
||||
@@ -1530,8 +1531,8 @@ void Position::GetPositionOffsetTo(const Position& endPos, Position& retOffset)
|
||||
float dx = endPos.GetPositionX() - GetPositionX();
|
||||
float dy = endPos.GetPositionY() - GetPositionY();
|
||||
|
||||
retOffset.m_positionX = dx * cos(GetOrientation()) + dy * sin(GetOrientation());
|
||||
retOffset.m_positionY = dy * cos(GetOrientation()) - dx * sin(GetOrientation());
|
||||
retOffset.m_positionX = dx * cos(GetOrientation()) + dy * std::sin(GetOrientation());
|
||||
retOffset.m_positionY = dy * cos(GetOrientation()) - dx * std::sin(GetOrientation());
|
||||
retOffset.m_positionZ = endPos.GetPositionZ() - GetPositionZ();
|
||||
retOffset.m_orientation = endPos.GetOrientation() - GetOrientation();
|
||||
}
|
||||
@@ -1559,7 +1560,7 @@ void Position::GetSinCos(const float x, const float y, float& vsin, float& vcos)
|
||||
{
|
||||
float angle = (float)rand_norm() * static_cast<float>(2 * M_PI);
|
||||
vcos = cos(angle);
|
||||
vsin = sin(angle);
|
||||
vsin = std::sin(angle);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1678,7 +1679,7 @@ void WorldObject::GetRandomPoint(const Position& pos, float distance, float& ran
|
||||
float new_dist = (float)rand_norm() * static_cast<float>(distance);
|
||||
|
||||
rand_x = pos.m_positionX + new_dist * cos(angle);
|
||||
rand_y = pos.m_positionY + new_dist * sin(angle);
|
||||
rand_y = pos.m_positionY + new_dist * std::sin(angle);
|
||||
rand_z = pos.m_positionZ;
|
||||
|
||||
Acore::NormalizeMapCoord(rand_x);
|
||||
@@ -2863,7 +2864,7 @@ void WorldObject::MovePosition(Position& pos, float dist, float angle)
|
||||
angle += m_orientation;
|
||||
float destx, desty, destz, ground, floor;
|
||||
destx = pos.m_positionX + dist * cos(angle);
|
||||
desty = pos.m_positionY + dist * sin(angle);
|
||||
desty = pos.m_positionY + dist * std::sin(angle);
|
||||
|
||||
// Prevent invalid coordinates here, position is unchanged
|
||||
if (!Acore::IsValidMapCoord(destx, desty))
|
||||
@@ -2884,7 +2885,7 @@ void WorldObject::MovePosition(Position& pos, float dist, float angle)
|
||||
if (std::fabs(pos.m_positionZ - destz) > 6.0f)
|
||||
{
|
||||
destx -= step * cos(angle);
|
||||
desty -= step * sin(angle);
|
||||
desty -= step * std::sin(angle);
|
||||
ground = GetMapHeight(destx, desty, MAX_HEIGHT);
|
||||
floor = GetMapHeight(destx, desty, pos.m_positionZ);
|
||||
destz = std::fabs(ground - pos.m_positionZ) <= std::fabs(floor - pos.m_positionZ) ? ground : floor;
|
||||
@@ -2945,7 +2946,7 @@ void WorldObject::MovePositionToFirstCollision(Position& pos, float dist, float
|
||||
angle += GetOrientation();
|
||||
float destx, desty, destz;
|
||||
destx = pos.m_positionX + dist * cos(angle);
|
||||
desty = pos.m_positionY + dist * sin(angle);
|
||||
desty = pos.m_positionY + dist * std::sin(angle);
|
||||
destz = pos.m_positionZ;
|
||||
|
||||
if (!GetMap()->CheckCollisionAndGetValidCoords(this, pos.m_positionX, pos.m_positionY, pos.m_positionZ, destx, desty, destz, false))
|
||||
|
||||
@@ -877,7 +877,7 @@ void StaticTransport::RelocateToProgress(uint32 progress)
|
||||
// reminder: WorldRotation only influences model rotation, not the path
|
||||
float sign = GetFloatValue(GAMEOBJECT_PARENTROTATION + 2) >= 0.0f ? 1.0f : -1.0f;
|
||||
float pathRotAngle = sign * 2.0f * acos(GetFloatValue(GAMEOBJECT_PARENTROTATION + 3));
|
||||
float cs = cos(pathRotAngle), sn = sin(pathRotAngle);
|
||||
float cs = cos(pathRotAngle), sn = std::sin(pathRotAngle);
|
||||
float nx = pos.x * cs - pos.y * sn;
|
||||
float ny = pos.x * sn + pos.y * cs;
|
||||
pos.x = nx;
|
||||
|
||||
@@ -18716,7 +18716,7 @@ void Unit::JumpTo(float speedXY, float speedZ, bool forward)
|
||||
else
|
||||
{
|
||||
float vcos = cos(angle + GetOrientation());
|
||||
float vsin = sin(angle + GetOrientation());
|
||||
float vsin = std::sin(angle + GetOrientation());
|
||||
|
||||
WorldPacket data(SMSG_MOVE_KNOCK_BACK, (8 + 4 + 4 + 4 + 4 + 4));
|
||||
data << GetPackGUID();
|
||||
@@ -18982,7 +18982,7 @@ void Unit::_ExitVehicle(Position const* exitPosition)
|
||||
else if (vehicle->GetVehicleInfo()->m_ID == 349) // AT Mounts, dismount to the right
|
||||
{
|
||||
float x = pos.GetPositionX() + 2.0f * cos(pos.GetOrientation() - M_PI / 2.0f);
|
||||
float y = pos.GetPositionY() + 2.0f * sin(pos.GetOrientation() - M_PI / 2.0f);
|
||||
float y = pos.GetPositionY() + 2.0f * std::sin(pos.GetOrientation() - M_PI / 2.0f);
|
||||
float z = GetMapHeight(x, y, pos.GetPositionZ());
|
||||
if (z > INVALID_HEIGHT)
|
||||
pos.Relocate(x, y, z);
|
||||
@@ -19017,7 +19017,7 @@ void Unit::_ExitVehicle(Position const* exitPosition)
|
||||
{
|
||||
float o = pos.GetAngle(this);
|
||||
Movement::MoveSplineInit init(this);
|
||||
init.MoveTo(pos.GetPositionX() + 8 * cos(o), pos.GetPositionY() + 8 * sin(o), pos.GetPositionZ() + 16.0f);
|
||||
init.MoveTo(pos.GetPositionX() + 8 * cos(o), pos.GetPositionY() + 8 * std::sin(o), pos.GetPositionZ() + 16.0f);
|
||||
init.SetFacing(GetOrientation());
|
||||
init.SetTransportExit();
|
||||
init.Launch();
|
||||
|
||||
Reference in New Issue
Block a user