aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Entities/Object
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/game/Entities/Object')
-rwxr-xr-xsrc/server/game/Entities/Object/Object.cpp48
1 files changed, 24 insertions, 24 deletions
diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp
index cc800dce7b8..2c5d448cc63 100755
--- a/src/server/game/Entities/Object/Object.cpp
+++ b/src/server/game/Entities/Object/Object.cpp
@@ -772,7 +772,7 @@ void Object::_LoadIntoDataField(char const* data, uint32 startOffset, uint32 cou
if (!data)
return;
- Tokens tokens(data, ' ', count);
+ Tokenizer tokens(data, ' ', count);
if (tokens.size() != count)
return;
@@ -1511,8 +1511,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() * std::cos(GetOrientation()) + offset.GetPositionY() * std::sin(GetOrientation() + M_PI));
+ m_positionY = GetPositionY() + (offset.GetPositionY() * std::cos(GetOrientation()) + offset.GetPositionX() * std::sin(GetOrientation()));
m_positionZ = GetPositionZ() + offset.GetPositionZ();
m_orientation = GetOrientation() + offset.GetOrientation();
}
@@ -1522,8 +1522,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 * std::cos(GetOrientation()) + dy * std::sin(GetOrientation());
+ retOffset.m_positionY = dy * std::cos(GetOrientation()) - dx * std::sin(GetOrientation());
retOffset.m_positionZ = endPos.GetPositionZ() - GetPositionZ();
retOffset.m_orientation = endPos.GetOrientation() - GetOrientation();
}
@@ -1555,8 +1555,8 @@ void Position::GetSinCos(const float x, const float y, float &vsin, float &vcos)
if (fabs(dx) < 0.001f && fabs(dy) < 0.001f)
{
float angle = (float)rand_norm()*static_cast<float>(2*M_PI);
- vcos = cos(angle);
- vsin = sin(angle);
+ vcos = std::cos(angle);
+ vsin = std::sin(angle);
}
else
{
@@ -1605,7 +1605,7 @@ bool WorldObject::IsInBetween(const WorldObject* obj1, const WorldObject* obj2,
float angle = obj1->GetAngle(obj2);
// not using sqrt() for performance
- return (size * size) >= GetExactDist2dSq(obj1->GetPositionX() + cos(angle) * dist, obj1->GetPositionY() + sin(angle) * dist);
+ return (size * size) >= GetExactDist2dSq(obj1->GetPositionX() + std::cos(angle) * dist, obj1->GetPositionY() + std::sin(angle) * dist);
}
bool WorldObject::isInFront(WorldObject const* target, float arc) const
@@ -1630,8 +1630,8 @@ void WorldObject::GetRandomPoint(const Position &pos, float distance, float &ran
float angle = (float)rand_norm()*static_cast<float>(2*M_PI);
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_x = pos.m_positionX + new_dist * std::cos(angle);
+ rand_y = pos.m_positionY + new_dist * std::sin(angle);
rand_z = pos.m_positionZ;
Trinity::NormalizeMapCoord(rand_x);
@@ -2649,8 +2649,8 @@ namespace Trinity
void WorldObject::GetNearPoint2D(float &x, float &y, float distance2d, float absAngle) const
{
- x = GetPositionX() + (GetObjectSize() + distance2d) * cos(absAngle);
- y = GetPositionY() + (GetObjectSize() + distance2d) * sin(absAngle);
+ x = GetPositionX() + (GetObjectSize() + distance2d) * std::cos(absAngle);
+ y = GetPositionY() + (GetObjectSize() + distance2d) * std::sin(absAngle);
Trinity::NormalizeMapCoord(x);
Trinity::NormalizeMapCoord(y);
@@ -2785,8 +2785,8 @@ 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);
+ destx = pos.m_positionX + dist * std::cos(angle);
+ desty = pos.m_positionY + dist * std::sin(angle);
// Prevent invalid coordinates here, position is unchanged
if (!Trinity::IsValidMapCoord(destx, desty, pos.m_positionZ))
@@ -2806,8 +2806,8 @@ void WorldObject::MovePosition(Position &pos, float dist, float angle)
// do not allow too big z changes
if (fabs(pos.m_positionZ - destz) > 6)
{
- destx -= step * cos(angle);
- desty -= step * sin(angle);
+ destx -= step * std::cos(angle);
+ desty -= step * std::sin(angle);
ground = GetMap()->GetHeight(GetPhaseMask(), destx, desty, MAX_HEIGHT, true);
floor = GetMap()->GetHeight(GetPhaseMask(), destx, desty, pos.m_positionZ, true);
destz = fabs(ground - pos.m_positionZ) <= fabs(floor - pos.m_positionZ) ? ground : floor;
@@ -2831,8 +2831,8 @@ void WorldObject::MovePositionToFirstCollision(Position &pos, float dist, float
angle += m_orientation;
float destx, desty, destz, ground, floor;
pos.m_positionZ += 2.0f;
- destx = pos.m_positionX + dist * cos(angle);
- desty = pos.m_positionY + dist * sin(angle);
+ destx = pos.m_positionX + dist * std::cos(angle);
+ desty = pos.m_positionY + dist * std::sin(angle);
// Prevent invalid coordinates here, position is unchanged
if (!Trinity::IsValidMapCoord(destx, desty))
@@ -2851,8 +2851,8 @@ void WorldObject::MovePositionToFirstCollision(Position &pos, float dist, float
if (col)
{
// move back a bit
- destx -= CONTACT_DISTANCE * cos(angle);
- desty -= CONTACT_DISTANCE * sin(angle);
+ destx -= CONTACT_DISTANCE * std::cos(angle);
+ desty -= CONTACT_DISTANCE * std::sin(angle);
dist = sqrt((pos.m_positionX - destx)*(pos.m_positionX - destx) + (pos.m_positionY - desty)*(pos.m_positionY - desty));
}
@@ -2862,8 +2862,8 @@ void WorldObject::MovePositionToFirstCollision(Position &pos, float dist, float
// Collided with a gameobject
if (col)
{
- destx -= CONTACT_DISTANCE * cos(angle);
- desty -= CONTACT_DISTANCE * sin(angle);
+ destx -= CONTACT_DISTANCE * std::cos(angle);
+ desty -= CONTACT_DISTANCE * std::sin(angle);
dist = sqrt((pos.m_positionX - destx)*(pos.m_positionX - destx) + (pos.m_positionY - desty)*(pos.m_positionY - desty));
}
@@ -2874,8 +2874,8 @@ void WorldObject::MovePositionToFirstCollision(Position &pos, float dist, float
// do not allow too big z changes
if (fabs(pos.m_positionZ - destz) > 6)
{
- destx -= step * cos(angle);
- desty -= step * sin(angle);
+ destx -= step * std::cos(angle);
+ desty -= step * std::sin(angle);
ground = GetMap()->GetHeight(GetPhaseMask(), destx, desty, MAX_HEIGHT, true);
floor = GetMap()->GetHeight(GetPhaseMask(), destx, desty, pos.m_positionZ, true);
destz = fabs(ground - pos.m_positionZ) <= fabs(floor - pos.m_positionZ) ? ground : floor;