aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Entities/Player/Player.cpp18
1 files changed, 4 insertions, 14 deletions
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index 5a9707fec75..7824587a7bc 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -21077,7 +21077,7 @@ void Player::SetRestBonus(float rest_bonus_new)
SetUInt32Value(PLAYER_REST_STATE_EXPERIENCE, uint32(m_rest_bonus));
}
-bool Player::ActivateTaxiPathTo(std::vector<uint32> const& nodes, Creature* npc /*= NULL*/, uint32 spellid /*= 0*/)
+bool Player::ActivateTaxiPathTo(std::vector<uint32> const& nodes, Creature* npc /*= nullptr*/, uint32 spellid /*= 0*/)
{
if (nodes.size() < 2)
return false;
@@ -21147,11 +21147,7 @@ bool Player::ActivateTaxiPathTo(std::vector<uint32> const& nodes, Creature* npc
// check node starting pos data set case if provided
if (node->x != 0.0f || node->y != 0.0f || node->z != 0.0f)
{
- if (node->map_id != GetMapId() ||
- (node->x - GetPositionX())*(node->x - GetPositionX())+
- (node->y - GetPositionY())*(node->y - GetPositionY())+
- (node->z - GetPositionZ())*(node->z - GetPositionZ()) >
- (2*INTERACTION_DISTANCE)*(2*INTERACTION_DISTANCE)*(2*INTERACTION_DISTANCE))
+ if (node->map_id != GetMapId() || !IsInDist(node->x, node->y, node->z, 2 * INTERACTION_DISTANCE))
{
GetSession()->SendActivateTaxiReply(ERR_TAXITOOFARAWAY);
return false;
@@ -21312,10 +21308,7 @@ void Player::ContinueTaxiFlight() const
TaxiPathNodeList const& nodeList = sTaxiPathNodesByPath[path];
float distPrev;
- float distNext =
- (nodeList[0]->LocX - GetPositionX())*(nodeList[0]->LocX - GetPositionX()) +
- (nodeList[0]->LocY - GetPositionY())*(nodeList[0]->LocY - GetPositionY()) +
- (nodeList[0]->LocZ - GetPositionZ())*(nodeList[0]->LocZ - GetPositionZ());
+ float distNext = GetExactDistSq(nodeList[0]->LocX, nodeList[0]->LocY, nodeList[0]->LocZ);
for (uint32 i = 1; i < nodeList.size(); ++i)
{
@@ -21328,10 +21321,7 @@ void Player::ContinueTaxiFlight() const
distPrev = distNext;
- distNext =
- (node->LocX - GetPositionX())*(node->LocX - GetPositionX()) +
- (node->LocY - GetPositionY())*(node->LocY - GetPositionY()) +
- (node->LocZ - GetPositionZ())*(node->LocZ - GetPositionZ());
+ distNext = GetExactDistSq(node->LocX, node->LocY, node->LocZ);
float distNodes =
(node->LocX - prevNode->LocX)*(node->LocX - prevNode->LocX) +