From 136dee691ad6e5f4706dddcf345c11459159eeb4 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 14:53:06 -0800 Subject: [PATCH 001/131] removed unused macro debug message --- zone/beacon.cpp | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/zone/beacon.cpp b/zone/beacon.cpp index c3988e866..aa44b2504 100644 --- a/zone/beacon.cpp +++ b/zone/beacon.cpp @@ -35,7 +35,7 @@ class Zone; #include "../common/races.h" #include "beacon.h" #include "entity.h" -#include "mob.h" +#include "mob.h" #ifdef BOTS @@ -68,19 +68,12 @@ Beacon::Beacon(Mob *at_mob, int lifetime) caster_id = 0; if(lifetime) - { remove_timer.Start(); - } -#ifdef SOLAR - entity_list.Message(0, 0, "Beacon being created at %0.2f %0.2f %0.2f heading %0.2f lifetime %d", GetX(), GetY(), GetZ(), GetHeading(), lifetime); -#endif } Beacon::~Beacon() { -#ifdef SOLAR - entity_list.Message(0, 0, "Beacon %d being removed at %0.2f %0.2f %0.2f heading %0.2f", GetID(), GetX(), GetY(), GetZ(), GetHeading()); -#endif + } bool Beacon::Process() From 9f8dad894c2755a27f4a8b9671bdcf1a9669fb73 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 15:22:46 -0800 Subject: [PATCH 002/131] Added 'GetTargetRingLocation' which will eventualy replace the individual GetTargetRing methods --- zone/mob.h | 1 + 1 file changed, 1 insertion(+) diff --git a/zone/mob.h b/zone/mob.h index 6e304c34a..89c3fc410 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -294,6 +294,7 @@ public: inline virtual uint32 GetNimbusEffect2() const { return nimbus_effect2; } inline virtual uint32 GetNimbusEffect3() const { return nimbus_effect3; } void RemoveNimbusEffect(int effectid); + inline const xyz_location& GetTargetRingLocation() const { return m_TargetRing; } inline float GetTargetRingX() const { return m_TargetRing.m_X; } inline float GetTargetRingY() const { return m_TargetRing.m_Y; } inline float GetTargetRingZ() const { return m_TargetRing.m_Z; } From e653a3943a11e9c7eb22f79ba8497f436c74a90b Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 15:32:04 -0800 Subject: [PATCH 003/131] removed usage of mob distnoroot and used ComparativeDistance instead --- zone/effects.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/zone/effects.cpp b/zone/effects.cpp index ec463bddf..0e71ca0eb 100644 --- a/zone/effects.cpp +++ b/zone/effects.cpp @@ -26,6 +26,7 @@ #include "string_ids.h" #include "worldserver.h" #include "zonedb.h" +#include "position.h" float Mob::GetActSpellRange(uint16 spell_id, float range, bool IsBard) { @@ -720,7 +721,7 @@ void EntityList::AESpell(Mob *caster, Mob *center, uint16 spell_id, bool affect_ continue; if (spells[spell_id].targettype == ST_Ring) { - dist_targ = curmob->DistNoRoot(caster->GetTargetRingX(), caster->GetTargetRingY(), caster->GetTargetRingZ()); + dist_targ = ComparativeDistance(curmob->GetPosition(), caster->GetTargetRingLocation()); } else if (center) { dist_targ = center->DistNoRoot(*curmob); From 91b2e23e563f99b63ecaf6ec74327d9f5ea1e0f1 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 15:37:24 -0800 Subject: [PATCH 004/131] removed usage of mob->distnoroot and switched to ComparativeDistance --- zone/effects.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/effects.cpp b/zone/effects.cpp index 0e71ca0eb..6206593ac 100644 --- a/zone/effects.cpp +++ b/zone/effects.cpp @@ -724,7 +724,7 @@ void EntityList::AESpell(Mob *caster, Mob *center, uint16 spell_id, bool affect_ dist_targ = ComparativeDistance(curmob->GetPosition(), caster->GetTargetRingLocation()); } else if (center) { - dist_targ = center->DistNoRoot(*curmob); + dist_targ = ComparativeDistance(static_cast(curmob->GetPosition()), static_cast(center->GetPosition())); } if (dist_targ > dist2) //make sure they are in range From 70a9a4e7cdfa6d655f5e4c63129336e4bc5880e0 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 15:42:58 -0800 Subject: [PATCH 005/131] Removed usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/entity.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/entity.cpp b/zone/entity.cpp index 6eb32b684..d62fd8880 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -1558,7 +1558,7 @@ Client *EntityList::GetRandomClient(const xyz_location& location, float Distance for (auto it = client_list.begin();it != client_list.end(); ++it) - if ((it->second != ExcludeClient) && (it->second->DistNoRoot(location.m_X, location.m_Y, location.m_Z) <= Distance)) + if ((it->second != ExcludeClient) && (ComparativeDistance(it->second->GetPosition(), location) <= Distance)) ClientsInRange.push_back(it->second); if (ClientsInRange.empty()) From f1759421d1c28f33d5a28075b5c2bc6bc7a3c7a4 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 15:51:26 -0800 Subject: [PATCH 006/131] Removed Mob::DistNoRoot(x,y,z) --- zone/mob.cpp | 10 ---------- zone/mob.h | 1 - 2 files changed, 11 deletions(-) diff --git a/zone/mob.cpp b/zone/mob.cpp index 1d2d7053e..4e2f3c9f2 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -2302,16 +2302,6 @@ float Mob::DistNoRoot(const Mob &other) const { + (zDiff * zDiff) ); } -float Mob::DistNoRoot(float x, float y, float z) const { - float xDiff = x - m_Position.m_X; - float yDiff = y - m_Position.m_Y; - float zDiff = z - m_Position.m_Z; - - return ( (xDiff * xDiff) - + (yDiff * yDiff) - + (zDiff * zDiff) ); -} - float Mob::DistNoRootNoZ(float x, float y) const { float xDiff = x - m_Position.m_X; float yDiff = y - m_Position.m_Y; diff --git a/zone/mob.h b/zone/mob.h index 89c3fc410..2afcd4aa0 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -514,7 +514,6 @@ public: float Dist(const Mob &) const; float DistNoZ(const Mob &) const; float DistNoRoot(const Mob &) const; - float DistNoRoot(float x, float y, float z) const; float DistNoRootNoZ(float x, float y) const; float DistNoRootNoZ(const Mob &) const; static float GetReciprocalHeading(Mob* target); From 2eaeb38138e53d8abcb8a50e5fd9eebc4cd5b370 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 15:56:06 -0800 Subject: [PATCH 007/131] Removed a usage of Mob::Dist and used Distance instead --- zone/client.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/zone/client.cpp b/zone/client.cpp index a988c04a6..ee48af831 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -40,6 +40,7 @@ extern volatile bool RunLoops; #include "../common/rulesys.h" #include "../common/string_util.h" #include "../common/data_verification.h" +#include "position.h" #include "net.h" #include "worldserver.h" #include "zonedb.h" @@ -3178,7 +3179,7 @@ void Client::Insight(uint32 t_id) Message(0,"This ability can only be used on NPCs."); return; } - if (Dist(*who) > 200) + if (Distance(static_cast(m_Position), static_cast(who->GetPosition())) > 200) { Message(0,"You must get closer to your target!"); return; From 77badffa299324ddf7e5b48187cd18036b8c8ad7 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 16:00:12 -0800 Subject: [PATCH 008/131] Removed a usage of Mob::Dist and used Distance instead --- zone/client_packet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 5cc3da16d..61a09094f 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -3025,7 +3025,7 @@ void Client::Handle_OP_Assist(const EQApplicationPacket *app) if (assistee->GetTarget()) { Mob *new_target = assistee->GetTarget(); if (new_target && (GetGM() || - Dist(*assistee) <= TARGETING_RANGE)) { + Distance(static_cast(m_Position), static_cast(assistee->GetPosition())) <= TARGETING_RANGE)) { SetAssistExemption(true); eid->entity_id = new_target->GetID(); } From a135a3d597fe9d9fdc1d9fa188c55ce935f0b6fe Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 16:08:45 -0800 Subject: [PATCH 009/131] Added explicit xyz_heading overrides for the 4 distance functions --- zone/effects.cpp | 4 ++-- zone/entity.cpp | 2 +- zone/position.cpp | 28 ++++++++++++++++++++++++++++ zone/position.h | 5 +++++ 4 files changed, 36 insertions(+), 3 deletions(-) diff --git a/zone/effects.cpp b/zone/effects.cpp index 6206593ac..d94f26159 100644 --- a/zone/effects.cpp +++ b/zone/effects.cpp @@ -721,10 +721,10 @@ void EntityList::AESpell(Mob *caster, Mob *center, uint16 spell_id, bool affect_ continue; if (spells[spell_id].targettype == ST_Ring) { - dist_targ = ComparativeDistance(curmob->GetPosition(), caster->GetTargetRingLocation()); + dist_targ = ComparativeDistance(static_cast(curmob->GetPosition()), caster->GetTargetRingLocation()); } else if (center) { - dist_targ = ComparativeDistance(static_cast(curmob->GetPosition()), static_cast(center->GetPosition())); + dist_targ = ComparativeDistance(curmob->GetPosition(), center->GetPosition()); } if (dist_targ > dist2) //make sure they are in range diff --git a/zone/entity.cpp b/zone/entity.cpp index d62fd8880..7e3b925ca 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -1558,7 +1558,7 @@ Client *EntityList::GetRandomClient(const xyz_location& location, float Distance for (auto it = client_list.begin();it != client_list.end(); ++it) - if ((it->second != ExcludeClient) && (ComparativeDistance(it->second->GetPosition(), location) <= Distance)) + if ((it->second != ExcludeClient) && (ComparativeDistance(static_cast(it->second->GetPosition()), location) <= Distance)) ClientsInRange.push_back(it->second); if (ClientsInRange.empty()) diff --git a/zone/position.cpp b/zone/position.cpp index ddbe429af..63c5b034f 100644 --- a/zone/position.cpp +++ b/zone/position.cpp @@ -145,6 +145,13 @@ float ComparativeDistance(const xyz_location& point1, const xyz_location& point2 return diff.m_X * diff.m_X + diff.m_Y * diff.m_Y + diff.m_Z * diff.m_Z; } +/** +* Produces the non square root'ed distance between the two points. +*/ +float ComparativeDistance(const xyz_heading& point1, const xyz_heading& point2) { + ComparativeDistance(static_cast(point1), static_cast(point2)); +} + /** * Produces the distance between the two points. */ @@ -152,6 +159,13 @@ float Distance(const xyz_location& point1, const xyz_location& point2) { return sqrt(ComparativeDistance(point1, point2)); } +/** +* Produces the distance between the two points. +*/ +float Distance(const xyz_heading& point1, const xyz_heading& point2) { + Distance(static_cast(point1), static_cast(point2)); +} + /** * Produces the distance between the two points within the XY plane. */ @@ -159,6 +173,13 @@ float DistanceNoZ(const xyz_location& point1, const xyz_location& point2) { return Distance(static_cast(point1),static_cast(point2)); } +/** +* Produces the distance between the two points within the XY plane. +*/ +float DistanceNoZ(const xyz_heading& point1, const xyz_heading& point2) { + return Distance(static_cast(point1),static_cast(point2)); +} + /** * Produces the non square root'ed distance between the two points within the XY plane. */ @@ -166,6 +187,13 @@ float ComparativeDistanceNoZ(const xyz_location& point1, const xyz_location& poi return ComparativeDistance(static_cast(point1),static_cast(point2)); } +/** +* Produces the non square root'ed distance between the two points within the XY plane. +*/ +float ComparativeDistanceNoZ(const xyz_heading& point1, const xyz_heading& point2) { + return ComparativeDistance(static_cast(point1),static_cast(point2)); +} + /** * Determines if 'position' is within (inclusive) the axis aligned * box (3 dimensional) formed from the points minimum and maximum. diff --git a/zone/position.h b/zone/position.h index fd66ede5f..30f8fcb1c 100644 --- a/zone/position.h +++ b/zone/position.h @@ -94,4 +94,9 @@ float Distance(const xyz_location& point1, const xyz_location& point2); float DistanceNoZ(const xyz_location& point1, const xyz_location& point2); float ComparativeDistanceNoZ(const xyz_location& point1, const xyz_location& point2); +float ComparativeDistance(const xyz_heading& point1, const xyz_heading& point2); +float Distance(const xyz_heading& point1, const xyz_heading& point2); +float DistanceNoZ(const xyz_heading& point1, const xyz_heading& point2); +float ComparativeDistanceNoZ(const xyz_heading& point1, const xyz_heading& point2); + #endif From 76afc1119902bb710e9e8914b9113a96d3c5e575 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 16:12:30 -0800 Subject: [PATCH 010/131] Overloads of xyz_heading means no longer need the static cast here --- zone/client_packet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 61a09094f..332a1cc98 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -3025,7 +3025,7 @@ void Client::Handle_OP_Assist(const EQApplicationPacket *app) if (assistee->GetTarget()) { Mob *new_target = assistee->GetTarget(); if (new_target && (GetGM() || - Distance(static_cast(m_Position), static_cast(assistee->GetPosition())) <= TARGETING_RANGE)) { + Distance(m_Position, assistee->GetPosition()) <= TARGETING_RANGE)) { SetAssistExemption(true); eid->entity_id = new_target->GetID(); } From 1bd4d38537f37389168bcddc7b826e6b7d63d95d Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 17:39:12 -0800 Subject: [PATCH 011/131] Removed usage of Mod::Dist and used Distance instead --- zone/command.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/command.cpp b/zone/command.cpp index ea527cbe8..3c42d00fb 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -10183,7 +10183,7 @@ void command_distance(Client *c, const Seperator *sep) { if(c && c->GetTarget()) { Mob* target = c->GetTarget(); - c->Message(0, "Your target, %s, is %1.1f units from you.", c->GetTarget()->GetName(), c->Dist(*target)); + c->Message(0, "Your target, %s, is %1.1f units from you.", c->GetTarget()->GetName(), Distance(c->GetPosition(), target->GetPosition())); } } From a60c37098cc540a3774baa8227b32e6ab190e144 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 17:41:26 -0800 Subject: [PATCH 012/131] Removed usage of Mod::Dist and used Distance instead --- zone/entity.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/entity.cpp b/zone/entity.cpp index 7e3b925ca..9884f825e 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -1119,7 +1119,7 @@ void EntityList::ChannelMessage(Mob *from, uint8 chan_num, uint8 language, filter = FilterAuctions; // // Only say is limited in range - if (chan_num != 8 || client->Dist(*from) < 200) + if (chan_num != 8 || Distance(client->GetPosition(), from->GetPosition()) < 200) if (filter == FilterNone || client->GetFilter(filter) != FilterHide) client->ChannelMessageSend(from->GetName(), 0, chan_num, language, lang_skill, buffer); ++it; From 8895dd599e4d93b25e6078005320735f490456e4 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 17:44:17 -0800 Subject: [PATCH 013/131] Removed usage of Mod::Dist and used Distance instead --- zone/entity.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/zone/entity.cpp b/zone/entity.cpp index 9884f825e..9cf0d45a5 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -2991,7 +2991,8 @@ void EntityList::MessageGroup(Mob *sender, bool skipclose, uint32 type, const ch auto it = client_list.begin(); while (it != client_list.end()) { - if (it->second != sender && (it->second->Dist(*sender) <= dist2 || it->second->GetGroup() == sender->CastToClient()->GetGroup())) { + if (it->second != sender && + (Distance(it->second->GetPosition(), sender->GetPosition()) <= dist2 || it->second->GetGroup() == sender->CastToClient()->GetGroup())) { it->second->Message(type, buffer); } ++it; From ee0b9edc21720ec17563ad29203b3bd511351f36 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 17:49:16 -0800 Subject: [PATCH 014/131] Removed Mob::Dist --- zone/mob.cpp | 10 ---------- zone/mob.h | 1 - 2 files changed, 11 deletions(-) diff --git a/zone/mob.cpp b/zone/mob.cpp index 4e2f3c9f2..6b7db13b2 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -2274,16 +2274,6 @@ bool Mob::CanThisClassBlock(void) const } } -float Mob::Dist(const Mob &other) const { - float xDiff = other.m_Position.m_X - m_Position.m_X; - float yDiff = other.m_Position.m_Y - m_Position.m_Y; - float zDiff = other.m_Position.m_Z - m_Position.m_Z; - - return sqrtf( (xDiff * xDiff) - + (yDiff * yDiff) - + (zDiff * zDiff) ); -} - float Mob::DistNoZ(const Mob &other) const { float xDiff = other.m_Position.m_X - m_Position.m_X; float yDiff = other.m_Position.m_Y - m_Position.m_Y; diff --git a/zone/mob.h b/zone/mob.h index 2afcd4aa0..d32777d8f 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -511,7 +511,6 @@ public: void ShowStats(Client* client); void ShowBuffs(Client* client); void ShowBuffList(Client* client); - float Dist(const Mob &) const; float DistNoZ(const Mob &) const; float DistNoRoot(const Mob &) const; float DistNoRootNoZ(float x, float y) const; From bff17cddf9d31805e7eae5f8a74f660d8eab411b Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 17:50:08 -0800 Subject: [PATCH 015/131] Removed a usage of Mob::DistNoZ and used DistanceNoZ instead --- zone/bot.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/bot.cpp b/zone/bot.cpp index e9d708d80..eeb005dd8 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -15811,7 +15811,7 @@ void EntityList::ShowSpawnWindow(Client* client, int Distance, bool NamedOnly) { for (auto it = mob_list.begin(); it != mob_list.end(); ++it) { curMob = it->second; - if (curMob && curMob->DistNoZ(*client)<=Distance) { + if (curMob && DistanceNoZ(curMob->GetPosition(), client->GetPosition()) <= Distance) { if(curMob->IsTrackable()) { Mob* cur_entity = curMob; int Extras = (cur_entity->IsBot() || cur_entity->IsPet() || cur_entity->IsFamiliar() || cur_entity->IsClient()); From 2d7297dc676c93005bf3dca955fbfcab3953d3b5 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 17:51:52 -0800 Subject: [PATCH 016/131] Removed a usage of Mob::DistNoZ and used DistanceNoZ instead --- zone/entity.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/entity.cpp b/zone/entity.cpp index 9cf0d45a5..486a65972 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -2942,7 +2942,7 @@ bool EntityList::MakeTrackPacket(Client *client) it->second->IsInvisible(client)) continue; - MobDistance = it->second->DistNoZ(*client); + MobDistance = DistanceNoZ(it->second->GetPosition(), client->GetPosition()); if (MobDistance > distance) continue; From 1e2198f5f4a760b8f4b0598568c77d2574e49533 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 17:53:41 -0800 Subject: [PATCH 017/131] Removed Mob::DistNoZ --- zone/mob.cpp | 8 -------- zone/mob.h | 1 - 2 files changed, 9 deletions(-) diff --git a/zone/mob.cpp b/zone/mob.cpp index 6b7db13b2..8b8a23747 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -2274,14 +2274,6 @@ bool Mob::CanThisClassBlock(void) const } } -float Mob::DistNoZ(const Mob &other) const { - float xDiff = other.m_Position.m_X - m_Position.m_X; - float yDiff = other.m_Position.m_Y - m_Position.m_Y; - - return sqrtf( (xDiff * xDiff) - + (yDiff * yDiff) ); -} - float Mob::DistNoRoot(const Mob &other) const { float xDiff = other.m_Position.m_X - m_Position.m_X; float yDiff = other.m_Position.m_Y - m_Position.m_Y; diff --git a/zone/mob.h b/zone/mob.h index d32777d8f..c78eee65c 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -511,7 +511,6 @@ public: void ShowStats(Client* client); void ShowBuffs(Client* client); void ShowBuffList(Client* client); - float DistNoZ(const Mob &) const; float DistNoRoot(const Mob &) const; float DistNoRootNoZ(float x, float y) const; float DistNoRootNoZ(const Mob &) const; From eb2eaa4d68a07deea4240dfbbbbd42d6e8f47ae3 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 17:57:36 -0800 Subject: [PATCH 018/131] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/aggro.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/aggro.cpp b/zone/aggro.cpp index b2b3881bb..847840b50 100644 --- a/zone/aggro.cpp +++ b/zone/aggro.cpp @@ -88,7 +88,7 @@ void EntityList::DescribeAggro(Client *towho, NPC *from_who, float d, bool verbo if (mob->IsClient()) //also ensures that mob != around continue; - if (mob->DistNoRoot(*from_who) > d2) + if (ComparativeDistance(mob->GetPosition(), from_who->GetPosition()) > d2) continue; if (engaged) { From f1937335dd4675a49b3089147804c09137d7f531 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 18:01:20 -0800 Subject: [PATCH 019/131] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/aggro.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/zone/aggro.cpp b/zone/aggro.cpp index 847840b50..918b7de10 100644 --- a/zone/aggro.cpp +++ b/zone/aggro.cpp @@ -150,7 +150,8 @@ void NPC::DescribeAggro(Client *towho, Mob *mob, bool verbose) { return; } - float dist2 = mob->DistNoRoot(*this); + float dist2 = ComparativeDistance(mob->GetPosition(), m_Position); + float iAggroRange2 = iAggroRange*iAggroRange; if( dist2 > iAggroRange2 ) { towho->Message(0, "...%s is out of range. %.3f > %.3f ", mob->GetName(), From 254ec5997cdcea9ce6563fe2063ae0674c3575ef Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 18:05:03 -0800 Subject: [PATCH 020/131] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/aggro.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/aggro.cpp b/zone/aggro.cpp index 918b7de10..f68c77efa 100644 --- a/zone/aggro.cpp +++ b/zone/aggro.cpp @@ -296,7 +296,7 @@ bool Mob::CheckWillAggro(Mob *mob) { return(false); } - float dist2 = mob->DistNoRoot(*this); + float dist2 = ComparativeDistance(mob->GetPosition(), m_Position); float iAggroRange2 = iAggroRange*iAggroRange; if( dist2 > iAggroRange2 ) { From f43bf5542f1f04ecde6bd7e932a28fe2c4d5ed73 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 18:07:16 -0800 Subject: [PATCH 021/131] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/aggro.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/aggro.cpp b/zone/aggro.cpp index f68c77efa..c0bd53d67 100644 --- a/zone/aggro.cpp +++ b/zone/aggro.cpp @@ -414,7 +414,7 @@ int EntityList::GetHatedCount(Mob *attacker, Mob *exclude) AggroRange *= AggroRange; - if (mob->DistNoRoot(*attacker) > AggroRange) + if (ComparativeDistance(mob->GetPosition(), attacker->GetPosition()) > AggroRange) continue; Count++; From f79bad8b4bbb0f562ed611d155875d3949c8e66b Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 18:09:43 -0800 Subject: [PATCH 022/131] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/aggro.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/aggro.cpp b/zone/aggro.cpp index c0bd53d67..98135153c 100644 --- a/zone/aggro.cpp +++ b/zone/aggro.cpp @@ -444,7 +444,7 @@ void EntityList::AIYellForHelp(Mob* sender, Mob* attacker) { // && !mob->IsCorpse() // && mob->IsAIControlled() && mob->GetPrimaryFaction() != 0 - && mob->DistNoRoot(*sender) <= r + && ComparativeDistance(mob->GetPosition(), sender->GetPosition()) <= r && !mob->IsEngaged() && ((!mob->IsPet()) || (mob->IsPet() && mob->GetOwner() && !mob->GetOwner()->IsClient())) // If we're a pet we don't react to any calls for help if our owner is a client From 64bd24d5f9a2d714532351533854f21aa3f94992 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 18:13:34 -0800 Subject: [PATCH 023/131] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/aggro.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/aggro.cpp b/zone/aggro.cpp index 98135153c..c3861f13e 100644 --- a/zone/aggro.cpp +++ b/zone/aggro.cpp @@ -471,7 +471,7 @@ void EntityList::AIYellForHelp(Mob* sender, Mob* attacker) { if(mob->CheckLosFN(sender)) { #if (EQDEBUG>=5) LogFile->write(EQEmuLog::Debug, "AIYellForHelp(\"%s\",\"%s\") %s attacking %s Dist %f Z %f", - sender->GetName(), attacker->GetName(), mob->GetName(), attacker->GetName(), mob->DistNoRoot(*sender), fabs(sender->GetZ()+mob->GetZ())); + sender->GetName(), attacker->GetName(), mob->GetName(), attacker->GetName(), ComparativeDistance(mob->GetPosition(), sender->GetPosition()), fabs(sender->GetZ()+mob->GetZ())); #endif mob->AddToHateList(attacker, 1, 0, false); } From 262ae383c9ef5e9ef13edcad7bfc04f47305d8ef Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 18:15:48 -0800 Subject: [PATCH 024/131] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/aggro.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/aggro.cpp b/zone/aggro.cpp index c3861f13e..7e8080cc7 100644 --- a/zone/aggro.cpp +++ b/zone/aggro.cpp @@ -878,7 +878,7 @@ bool Mob::CombatRange(Mob* other) if (size_mod > 10000) size_mod = size_mod / 7; - float _DistNoRoot = DistNoRoot(*other); + float _DistNoRoot = ComparativeDistance(m_Position, other->GetPosition()); if (GetSpecialAbility(NPC_CHASE_DISTANCE)){ From 815a2084928841a83c52c24521fe94febb36a310 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 18:18:35 -0800 Subject: [PATCH 025/131] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/bot.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/bot.cpp b/zone/bot.cpp index eeb005dd8..e368364b6 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -3505,7 +3505,7 @@ void Bot::AI_Process() { if(IsBotCasterCombatRange(GetTarget())) atCombatRange = true; } - else if(DistNoRoot(*GetTarget()) <= meleeDistance) { + else if(ComparativeDistance(m_Position, GetTarget()->GetPosition()) <= meleeDistance) { atCombatRange = true; } From d71fc61511c1249084a6584be9d646fc791c0546 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 18:20:29 -0800 Subject: [PATCH 026/131] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/bot.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/bot.cpp b/zone/bot.cpp index e368364b6..e420f7a99 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -3732,7 +3732,7 @@ void Bot::AI_Process() { Mob* follow = entity_list.GetMob(GetFollowID()); if(follow) { - float dist = DistNoRoot(*follow); + float dist = ComparativeDistance(m_Position, follow->GetPosition()); float speed = follow->GetRunspeed(); if(dist < GetFollowDistance() + 1000) From 86639f924d260e38d05d19407fb02a48d87c23f7 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 18:22:48 -0800 Subject: [PATCH 027/131] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/bot.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/bot.cpp b/zone/bot.cpp index e420f7a99..7326a9e42 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -4003,7 +4003,7 @@ void Bot::PetAIProcess() { switch(pStandingPetOrder) { case SPO_Follow: { - float dist = botPet->DistNoRoot(*botPet->GetTarget()); + float dist = ComparativeDistance(botPet->GetPosition(), botPet->GetTarget()->GetPosition()); botPet->SetRunAnimSpeed(0); if(dist > 184) { botPet->CalculateNewPosition2(botPet->GetTarget()->GetX(), botPet->GetTarget()->GetY(), botPet->GetTarget()->GetZ(), botPet->GetTarget()->GetRunspeed()); From 1303a297c014c113512351958a7731254381b4b2 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 18:26:14 -0800 Subject: [PATCH 028/131] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/botspellsai.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/botspellsai.cpp b/zone/botspellsai.cpp index a5be7341e..68da92cae 100644 --- a/zone/botspellsai.cpp +++ b/zone/botspellsai.cpp @@ -898,7 +898,7 @@ bool Bot::AIDoSpellCast(uint8 i, Mob* tar, int32 mana_cost, uint32* oDontDoAgain if (AIspells[i].type & SpellType_Escape) { dist2 = 0; } else - dist2 = DistNoRoot(*tar); + dist2 = ComparativeDistance(m_Position, tar->GetPosition()); if (((((spells[AIspells[i].spellid].targettype==ST_GroupTeleport && AIspells[i].type==2) || spells[AIspells[i].spellid].targettype==ST_AECaster From 78eb852ed3c64d01e7a8b45e342aa3ff03b4be1d Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 18:32:41 -0800 Subject: [PATCH 029/131] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/client.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/client.cpp b/zone/client.cpp index ee48af831..cee43648e 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -2540,7 +2540,7 @@ bool Client::BindWound(Mob* bindmob, bool start, bool fail){ } else { - if (!GetFeigned() && (bindmob->DistNoRoot(*this) <= 400)) { + if (!GetFeigned() && (ComparativeDistance(bindmob->GetPosition(), m_Position) <= 400)) { // send bindmob bind done if(!bindmob->IsAIControlled() && bindmob != this ) { From 9400b860a3c0db8e8a0ced779fbe386bab2e87e7 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 18:37:01 -0800 Subject: [PATCH 030/131] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/client_packet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 332a1cc98..2092998d3 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -2030,7 +2030,7 @@ void Client::Handle_OP_AdventureMerchantPurchase(const EQApplicationPacket *app) return; //you have to be somewhat close to them to be properly using them - if (DistNoRoot(*tmp) > USE_NPC_RANGE2) + if (ComparativeDistance(m_Position, tmp->GetPosition()) > USE_NPC_RANGE2) return; merchantid = tmp->CastToNPC()->MerchantType; From e8144cb3eee888af37fa61e8d69132a84f14dc3d Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 18:39:59 -0800 Subject: [PATCH 031/131] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/client_packet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 2092998d3..b2e8ec43c 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -2205,7 +2205,7 @@ void Client::Handle_OP_AdventureMerchantRequest(const EQApplicationPacket *app) return; //you have to be somewhat close to them to be properly using them - if (DistNoRoot(*tmp) > USE_NPC_RANGE2) + if (ComparativeDistance(m_Position, tmp->GetPosition()) > USE_NPC_RANGE2) return; merchantid = tmp->CastToNPC()->MerchantType; From 65bd2cf8aca6c87bc936c674993cbd4030577494 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 18:42:59 -0800 Subject: [PATCH 032/131] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/client_packet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index b2e8ec43c..be8defcfc 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -2296,7 +2296,7 @@ void Client::Handle_OP_AdventureMerchantSell(const EQApplicationPacket *app) return; } - if (DistNoRoot(*vendor) > USE_NPC_RANGE2) + if (ComparativeDistance(m_Position, vendor->GetPosition()) > USE_NPC_RANGE2) { Message(13, "Vendor is out of range."); return; From 8efb9e75f89af3625e1fda042d9ca4acd5a0d2b1 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 18:49:24 -0800 Subject: [PATCH 033/131] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/client_packet.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index be8defcfc..6faed0e44 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -2554,7 +2554,7 @@ void Client::Handle_OP_AltCurrencyMerchantRequest(const EQApplicationPacket *app NPC* tar = entity_list.GetNPCByID(*((uint32*)app->pBuffer)); if (tar) { - if (DistNoRoot(*tar) > USE_NPC_RANGE2) + if (ComparativeDistance(m_Position, tar->GetPosition()) > USE_NPC_RANGE2) return; if (tar->GetClass() != ALT_CURRENCY_MERCHANT) { @@ -2633,7 +2633,7 @@ void Client::Handle_OP_AltCurrencyPurchase(const EQApplicationPacket *app) AltCurrencyPurchaseItem_Struct *purchase = (AltCurrencyPurchaseItem_Struct*)app->pBuffer; NPC* tar = entity_list.GetNPCByID(purchase->merchant_entity_id); if (tar) { - if (DistNoRoot(*tar) > USE_NPC_RANGE2) + if (ComparativeDistance(m_Position, tar->GetPosition())> USE_NPC_RANGE2) return; if (tar->GetClass() != ALT_CURRENCY_MERCHANT) { From e54cdad85d0d953c498a0485e683d0d3c2744dab Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 18:51:06 -0800 Subject: [PATCH 034/131] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/client_packet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 6faed0e44..4f2298344 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -2770,7 +2770,7 @@ void Client::Handle_OP_AltCurrencySell(const EQApplicationPacket *app) NPC* tar = entity_list.GetNPCByID(sell->merchant_entity_id); if (tar) { - if (DistNoRoot(*tar) > USE_NPC_RANGE2) + if (ComparativeDistance(m_Position, tar->GetPosition()) > USE_NPC_RANGE2) return; if (tar->GetClass() != ALT_CURRENCY_MERCHANT) { From 6b3099daac2aa5c8e026c1a3fb3a449f9e510ccf Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 18:54:57 -0800 Subject: [PATCH 035/131] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/client_packet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 4f2298344..0b8315b57 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -2867,7 +2867,7 @@ void Client::Handle_OP_AltCurrencySellSelection(const EQApplicationPacket *app) AltCurrencySelectItem_Struct *select = (AltCurrencySelectItem_Struct*)app->pBuffer; NPC* tar = entity_list.GetNPCByID(select->merchant_entity_id); if (tar) { - if (DistNoRoot(*tar) > USE_NPC_RANGE2) + if (ComparativeDistance(m_Position, tar->GetPosition()) > USE_NPC_RANGE2) return; if (tar->GetClass() != ALT_CURRENCY_MERCHANT) { From 926cba2cdc2520162fb4627dcf6187e5938dc1c7 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 18:57:52 -0800 Subject: [PATCH 036/131] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/client_packet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 0b8315b57..265a1625d 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -9414,7 +9414,7 @@ void Client::Handle_OP_MercenaryDataRequest(const EQApplicationPacket *app) int mercTypeCount = 0; int mercCount = 0; - if (DistNoRoot(*tar) > USE_NPC_RANGE2) + if (ComparativeDistance(m_Position, tar->GetPosition()) > USE_NPC_RANGE2) return; if (tar->GetClass() != MERCERNARY_MASTER) { From 6f209fd8b9a9fc08494e91776275cded7541852a Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 19:00:57 -0800 Subject: [PATCH 037/131] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/client_packet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 265a1625d..867a90156 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -9796,7 +9796,7 @@ void Client::Handle_OP_OpenGuildTributeMaster(const EQApplicationPacket *app) StartTribute_Struct* st = (StartTribute_Struct*)app->pBuffer; Mob* tribmast = entity_list.GetMob(st->tribute_master_id); if (tribmast && tribmast->IsNPC() && tribmast->GetClass() == GUILD_TRIBUTE_MASTER - && DistNoRoot(*tribmast) <= USE_NPC_RANGE2) { + && ComparativeDistance(m_Position, tribmast->GetPosition()) <= USE_NPC_RANGE2) { st->response = 1; QueuePacket(app); tribute_master_id = st->tribute_master_id; From bcc4c1e4b6a28c8001165d696614a9b100ec7fca Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 19:07:25 -0800 Subject: [PATCH 038/131] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/client_packet.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 867a90156..70917df1d 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -9828,7 +9828,7 @@ void Client::Handle_OP_OpenTributeMaster(const EQApplicationPacket *app) StartTribute_Struct* st = (StartTribute_Struct*)app->pBuffer; Mob* tribmast = entity_list.GetMob(st->tribute_master_id); if (tribmast && tribmast->IsNPC() && tribmast->GetClass() == TRIBUTE_MASTER - && DistNoRoot(*tribmast) <= USE_NPC_RANGE2) { + && ComparativeDistance(m_Position, tribmast->GetPosition()) <= USE_NPC_RANGE2) { st->response = 1; QueuePacket(app); tribute_master_id = st->tribute_master_id; @@ -12102,7 +12102,7 @@ void Client::Handle_OP_ShopPlayerBuy(const EQApplicationPacket *app) if (mp->quantity < 1) return; //you have to be somewhat close to them to be properly using them - if (DistNoRoot(*tmp) > USE_NPC_RANGE2) + if (ComparativeDistance(m_Position, tmp->GetPosition()) > USE_NPC_RANGE2) return; merchantid = tmp->CastToNPC()->MerchantType; From 6b979d1c5de8155d064b26b72fd2f7aca78407c9 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 19:09:32 -0800 Subject: [PATCH 039/131] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/client_packet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 70917df1d..cdaf755b3 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -12351,7 +12351,7 @@ void Client::Handle_OP_ShopPlayerSell(const EQApplicationPacket *app) return; //you have to be somewhat close to them to be properly using them - if (DistNoRoot(*vendor) > USE_NPC_RANGE2) + if (ComparativeDistance(m_Position, vendor->GetPosition()) > USE_NPC_RANGE2) return; uint32 price = 0; From 80154d06615e8603fc42581a0fc01f6d7a04abe4 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 19:13:47 -0800 Subject: [PATCH 040/131] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/client_packet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index cdaf755b3..f0e411923 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -12510,7 +12510,7 @@ void Client::Handle_OP_ShopRequest(const EQApplicationPacket *app) return; //you have to be somewhat close to them to be properly using them - if (DistNoRoot(*tmp) > USE_NPC_RANGE2) + if (ComparativeDistance(m_Position, tmp->GetPosition()) > USE_NPC_RANGE2) return; merchantid = tmp->CastToNPC()->MerchantType; From 0c3efc3c4ff29d9cdf6629bc71d5c14fb4b37a52 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 19:16:45 -0800 Subject: [PATCH 041/131] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/client_packet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index f0e411923..e9482f8b8 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -13006,7 +13006,7 @@ void Client::Handle_OP_TargetCommand(const EQApplicationPacket *app) // For /target, send reject or success packet if (app->GetOpcode() == OP_TargetCommand) { - if (GetTarget() && !GetTarget()->CastToMob()->IsInvisible(this) && (DistNoRoot(*GetTarget()) <= TARGETING_RANGE*TARGETING_RANGE || GetGM())) { + if (GetTarget() && !GetTarget()->CastToMob()->IsInvisible(this) && (ComparativeDistance(m_Position, GetTarget()->GetPosition()) <= TARGETING_RANGE*TARGETING_RANGE || GetGM())) { if (GetTarget()->GetBodyType() == BT_NoTarget2 || GetTarget()->GetBodyType() == BT_Special || GetTarget()->GetBodyType() == BT_NoTarget) { From 4174036ce7b0e03ce0780eb0d0940321e8aa2aaf Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 19:22:59 -0800 Subject: [PATCH 042/131] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/client_packet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index e9482f8b8..73b25b6b7 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -13097,7 +13097,7 @@ void Client::Handle_OP_TargetCommand(const EQApplicationPacket *app) { if (GetBindSightTarget()->DistNoRoot(*GetTarget()) > (zone->newzone_data.maxclip*zone->newzone_data.maxclip)) { - if (DistNoRoot(*GetTarget()) > (zone->newzone_data.maxclip*zone->newzone_data.maxclip)) + if (ComparativeDistance(m_Position, GetTarget()->GetPosition()) > (zone->newzone_data.maxclip*zone->newzone_data.maxclip)) { char *hacker_str = nullptr; MakeAnyLenString(&hacker_str, "%s attempting to target something beyond the clip plane of %.2f units," From 6d7e8d7e9a0b5f506c8b6573f05e86b0ca0ad6be Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 19:32:34 -0800 Subject: [PATCH 043/131] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/client_packet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 73b25b6b7..b9e1fae0e 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -13095,7 +13095,7 @@ void Client::Handle_OP_TargetCommand(const EQApplicationPacket *app) } else if (GetBindSightTarget()) { - if (GetBindSightTarget()->DistNoRoot(*GetTarget()) > (zone->newzone_data.maxclip*zone->newzone_data.maxclip)) + if (ComparativeDistance(GetBindSightTarget()->GetPosition(), GetTarget()->GetPosition()) > (zone->newzone_data.maxclip*zone->newzone_data.maxclip)) { if (ComparativeDistance(m_Position, GetTarget()->GetPosition()) > (zone->newzone_data.maxclip*zone->newzone_data.maxclip)) { From 0351ea2d3387bc315f1c0c67a1f144e5747e2ee4 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 19:35:39 -0800 Subject: [PATCH 044/131] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/client_packet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index b9e1fae0e..dc53a02f7 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -13111,7 +13111,7 @@ void Client::Handle_OP_TargetCommand(const EQApplicationPacket *app) } } } - else if (DistNoRoot(*GetTarget()) > (zone->newzone_data.maxclip*zone->newzone_data.maxclip)) + else if (ComparativeDistance(m_Position, GetTarget()->GetPosition()) > (zone->newzone_data.maxclip*zone->newzone_data.maxclip)) { char *hacker_str = nullptr; MakeAnyLenString(&hacker_str, "%s attempting to target something beyond the clip plane of %.2f units," From dc1db1fa0d2d855916bd38f0eac5dc58c3c0b869 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 19:45:42 -0800 Subject: [PATCH 045/131] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/client_packet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index dc53a02f7..1474e024b 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -13743,7 +13743,7 @@ void Client::Handle_OP_TributeItem(const EQApplicationPacket *app) Mob* tribmast = entity_list.GetMob(t->tribute_master_id); if (!tribmast || !tribmast->IsNPC() || tribmast->GetClass() != TRIBUTE_MASTER) return; - if (DistNoRoot(*tribmast) > USE_NPC_RANGE2) + if (ComparativeDistance(m_Position, tribmast->GetPosition()) > USE_NPC_RANGE2) return; t->tribute_points = TributeItem(t->slot, t->quantity); From a5521badb157a0c5f3e2846376004a7755b5870d Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 20:03:11 -0800 Subject: [PATCH 046/131] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/client_packet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 1474e024b..8bd986225 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -13772,7 +13772,7 @@ void Client::Handle_OP_TributeMoney(const EQApplicationPacket *app) Mob* tribmast = entity_list.GetMob(t->tribute_master_id); if (!tribmast || !tribmast->IsNPC() || tribmast->GetClass() != TRIBUTE_MASTER) return; - if (DistNoRoot(*tribmast) > USE_NPC_RANGE2) + if (ComparativeDistance(m_Position, tribmast->GetPosition()) > USE_NPC_RANGE2) return; t->tribute_points = TributeMoney(t->platinum); From 2b72a50f91ad07ed7cc39042a7a04c7f04e44407 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 20:08:29 -0800 Subject: [PATCH 047/131] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/client_process.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/client_process.cpp b/zone/client_process.cpp index 542390da9..e7eef4bbc 100644 --- a/zone/client_process.cpp +++ b/zone/client_process.cpp @@ -1601,7 +1601,7 @@ void Client::OPGMTraining(const EQApplicationPacket *app) return; //you have to be somewhat close to a trainer to be properly using them - if(DistNoRoot(*pTrainer) > USE_NPC_RANGE2) + if(ComparativeDistance(m_Position,pTrainer->GetPosition()) > USE_NPC_RANGE2) return; // if this for-loop acts up again (crashes linux), try enabling the before and after #pragmas From e44d9ce77f700e9e8e05c38139a5ff8bcd5e79c7 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 20:14:05 -0800 Subject: [PATCH 048/131] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/client_process.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/client_process.cpp b/zone/client_process.cpp index e7eef4bbc..2f2498530 100644 --- a/zone/client_process.cpp +++ b/zone/client_process.cpp @@ -1649,7 +1649,7 @@ void Client::OPGMEndTraining(const EQApplicationPacket *app) return; //you have to be somewhat close to a trainer to be properly using them - if(DistNoRoot(*pTrainer) > USE_NPC_RANGE2) + if(ComparativeDistance(m_Position, pTrainer->GetPosition()) > USE_NPC_RANGE2) return; // goodbye message From 608809a5dcf5a3de77d9f264307010b8864650dc Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 20:45:32 -0800 Subject: [PATCH 049/131] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/client_process.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/client_process.cpp b/zone/client_process.cpp index 2f2498530..fc94fd415 100644 --- a/zone/client_process.cpp +++ b/zone/client_process.cpp @@ -1678,7 +1678,7 @@ void Client::OPGMTrainSkill(const EQApplicationPacket *app) return; //you have to be somewhat close to a trainer to be properly using them - if(DistNoRoot(*pTrainer) > USE_NPC_RANGE2) + if(ComparativeDistance(m_Position, pTrainer->GetPosition()) > USE_NPC_RANGE2) return; if (gmskill->skillbank == 0x01) From ef68b46c9cee578b8a0c93833d54028158f307f2 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 20:49:09 -0800 Subject: [PATCH 050/131] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/effects.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/effects.cpp b/zone/effects.cpp index d94f26159..34b03de38 100644 --- a/zone/effects.cpp +++ b/zone/effects.cpp @@ -796,7 +796,7 @@ void EntityList::MassGroupBuff(Mob *caster, Mob *center, uint16 spell_id, bool a continue; if (curmob == caster && !affect_caster) //watch for caster too continue; - if (center->DistNoRoot(*curmob) > dist2) //make sure they are in range + if (ComparativeDistance(center->GetPosition(), curmob->GetPosition()) > dist2) //make sure they are in range continue; //Only npcs mgb should hit are client pets... From 4fa102cb2408a638169d3d7887ac1f33e56322e8 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 20:53:08 -0800 Subject: [PATCH 051/131] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/effects.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/effects.cpp b/zone/effects.cpp index 34b03de38..103f3521d 100644 --- a/zone/effects.cpp +++ b/zone/effects.cpp @@ -838,7 +838,7 @@ void EntityList::AEBardPulse(Mob *caster, Mob *center, uint16 spell_id, bool aff continue; if (curmob == caster && !affect_caster) //watch for caster too continue; - if (center->DistNoRoot(*curmob) > dist2) //make sure they are in range + if (ComparativeDistance(center->GetPosition(), curmob->GetPosition()) > dist2) //make sure they are in range continue; if (isnpc && curmob->IsNPC()) { //check npc->npc casting FACTION_VALUE f = curmob->GetReverseFactionCon(caster); From 93c5422966f9fd8155c5eac87edf32a00283ff32 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 21:35:30 -0800 Subject: [PATCH 052/131] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/effects.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/effects.cpp b/zone/effects.cpp index 103f3521d..1a988d500 100644 --- a/zone/effects.cpp +++ b/zone/effects.cpp @@ -888,7 +888,7 @@ void EntityList::AEAttack(Mob *attacker, float dist, int Hand, int count, bool I && curmob != attacker //this is not needed unless NPCs can use this &&(attacker->IsAttackAllowed(curmob)) && curmob->GetRace() != 216 && curmob->GetRace() != 472 /* dont attack horses */ - && (curmob->DistNoRoot(*attacker) <= dist2) + && (ComparativeDistance(curmob->GetPosition(), attacker->GetPosition()) <= dist2) ) { attacker->Attack(curmob, Hand, false, false, IsFromSpell); hit++; From 8eea92654fe68584f84e7489614cc1d3ddf06c0c Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 21:38:44 -0800 Subject: [PATCH 053/131] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/entity.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/entity.cpp b/zone/entity.cpp index 486a65972..2cd9d740f 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -1442,7 +1442,7 @@ void EntityList::QueueCloseClients(Mob *sender, const EQApplicationPacket *app, || (filter2 == FilterShowGroupOnly && (sender == ent || (ent->GetGroup() && ent->GetGroup()->IsGroupMember(sender)))) || (filter2 == FilterShowSelfOnly && ent == sender)) - && (ent->DistNoRoot(*sender) <= dist2)) { + && (ComparativeDistance(ent->GetPosition(), sender->GetPosition()) <= dist2)) { ent->QueuePacket(app, ackreq, Client::CLIENT_CONNECTED); } } From 3f37aef41c0bf75b2778bca23d5d3745b1418a2e Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 21:41:53 -0800 Subject: [PATCH 054/131] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/entity.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/entity.cpp b/zone/entity.cpp index 2cd9d740f..2f21f29d9 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -1921,7 +1921,7 @@ void EntityList::MessageClose_StringID(Mob *sender, bool skipsender, float dist, for (auto it = client_list.begin(); it != client_list.end(); ++it) { c = it->second; - if(c && c->DistNoRoot(*sender) <= dist2 && (!skipsender || c != sender)) + if(c && ComparativeDistance(c->GetPosition(), sender->GetPosition()) <= dist2 && (!skipsender || c != sender)) c->Message_StringID(type, string_id, message1, message2, message3, message4, message5, message6, message7, message8, message9); } } From 7dce5c4e6fbb89e378f4deebd1bc9e334bd9ebb6 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 21:45:31 -0800 Subject: [PATCH 055/131] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/entity.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/entity.cpp b/zone/entity.cpp index 2f21f29d9..95ae4bf8d 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -1937,7 +1937,7 @@ void EntityList::FilteredMessageClose_StringID(Mob *sender, bool skipsender, for (auto it = client_list.begin(); it != client_list.end(); ++it) { c = it->second; - if (c && c->DistNoRoot(*sender) <= dist2 && (!skipsender || c != sender)) + if (c && ComparativeDistance(c->GetPosition(), sender->GetPosition()) <= dist2 && (!skipsender || c != sender)) c->FilteredMessage_StringID(sender, type, filter, string_id, message1, message2, message3, message4, message5, message6, message7, message8, message9); From 91221db4c9121709bf12a0e6d1dc57a7a7dc68a3 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 22:07:17 -0800 Subject: [PATCH 056/131] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/entity.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zone/entity.cpp b/zone/entity.cpp index 95ae4bf8d..3393c19a9 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -1985,7 +1985,7 @@ void EntityList::MessageClose(Mob* sender, bool skipsender, float dist, uint32 t auto it = client_list.begin(); while (it != client_list.end()) { - if (it->second->DistNoRoot(*sender) <= dist2 && (!skipsender || it->second != sender)) + if (ComparativeDistance(it->second->GetPosition(), sender->GetPosition()) <= dist2 && (!skipsender || it->second != sender)) it->second->Message(type, buffer); ++it; } @@ -2460,7 +2460,7 @@ void EntityList::SendPositionUpdates(Client *client, uint32 cLastUpdate, //bool Grouped = client->HasGroup() && mob->IsClient() && (client->GetGroup() == mob->CastToClient()->GetGroup()); //if (range == 0 || (iterator.GetData() == alwayssend) || Grouped || (mob->DistNoRootNoZ(*client) <= range)) { - if (range == 0 || (it->second == alwayssend) || mob->IsClient() || (mob->DistNoRoot(*client) <= range)) { + if (range == 0 || (it->second == alwayssend) || mob->IsClient() || (ComparativeDistance(mob->GetPosition(), client->GetPosition()) <= range)) { mob->MakeSpawnUpdate(ppu); } if(mob && mob->IsClient() && mob->GetID()>0) { From 84c82ca4ab1fb08d87e17f8e457e9aa859788cec Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 22:12:36 -0800 Subject: [PATCH 057/131] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/entity.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/entity.cpp b/zone/entity.cpp index 3393c19a9..4dc914273 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -3546,7 +3546,7 @@ void EntityList::RadialSetLogging(Mob *around, bool enabled, bool clients, continue; } - if (around->DistNoRoot(*mob) > range2) + if (ComparativeDistance(around->GetPosition(), mob->GetPosition()) > range2) continue; if (enabled) From d01f307edcc475954122a6d080c0916c1a9af863 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 22:34:49 -0800 Subject: [PATCH 058/131] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/entity.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/entity.cpp b/zone/entity.cpp index 4dc914273..bb985ddce 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -3666,7 +3666,7 @@ void EntityList::QuestJournalledSayClose(Mob *sender, Client *QuestInitiator, // Use the old method for all other nearby clients for (auto it = client_list.begin(); it != client_list.end(); ++it) { c = it->second; - if(c && (c != QuestInitiator) && c->DistNoRoot(*sender) <= dist2) + if(c && (c != QuestInitiator) && ComparativeDistance(c->GetPosition(), sender->GetPosition()) <= dist2) c->Message_StringID(10, GENERIC_SAY, mobname, message); } } From 30eb545b0bd7faddce130bf6c76505e4fb19e7df Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 22:36:59 -0800 Subject: [PATCH 059/131] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/entity.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/entity.cpp b/zone/entity.cpp index bb985ddce..2b0551a26 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -3868,7 +3868,7 @@ Mob *EntityList::GetTargetForMez(Mob *caster) continue; } - if (caster->DistNoRoot(*d) > 22250) { //only pick targets within 150 range + if (ComparativeDistance(caster->GetPosition(), d->GetPosition()) > 22250) { //only pick targets within 150 range ++it; continue; } From 55024a861535867d581dcd8dd73a2ad8e5083200 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 22:41:04 -0800 Subject: [PATCH 060/131] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/groups.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zone/groups.cpp b/zone/groups.cpp index 6adc6735a..4b18abb40 100644 --- a/zone/groups.cpp +++ b/zone/groups.cpp @@ -758,7 +758,7 @@ void Group::CastGroupSpell(Mob* caster, uint16 spell_id) { } else if(members[z] != nullptr) { - distance = caster->DistNoRoot(*members[z]); + distance = ComparativeDistance(caster->GetPosition(), members[z]->GetPosition()); if(distance <= range2 && distance >= min_range2) { members[z]->CalcSpellPowerDistanceMod(spell_id, distance); caster->SpellOnTarget(spell_id, members[z]); @@ -798,7 +798,7 @@ void Group::GroupBardPulse(Mob* caster, uint16 spell_id) { } else if(members[z] != nullptr) { - distance = caster->DistNoRoot(*members[z]); + distance = ComparativeDistance(caster->GetPosition(), members[z]->GetPosition()); if(distance <= range2) { members[z]->BardPulse(spell_id, caster); #ifdef GROUP_BUFF_PETS From 15bd08b365f799fefb9d1ea153085399515fd596 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 22:52:33 -0800 Subject: [PATCH 061/131] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/groups.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/groups.cpp b/zone/groups.cpp index 4b18abb40..e1bfcb695 100644 --- a/zone/groups.cpp +++ b/zone/groups.cpp @@ -1197,7 +1197,7 @@ void Group::HealGroup(uint32 heal_amt, Mob* caster, float range) for(; gi < MAX_GROUP_MEMBERS; gi++) { if(members[gi]){ - distance = caster->DistNoRoot(*members[gi]); + distance = ComparativeDistance(caster->GetPosition(), members[gi]->GetPosition()); if(distance <= range2){ numMem += 1; } From a9c5f80968a9e3a2cddba4324d2e4ddaf1b143a1 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 23:07:04 -0800 Subject: [PATCH 062/131] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/groups.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zone/groups.cpp b/zone/groups.cpp index e1bfcb695..a3e948fc1 100644 --- a/zone/groups.cpp +++ b/zone/groups.cpp @@ -1208,7 +1208,7 @@ void Group::HealGroup(uint32 heal_amt, Mob* caster, float range) for(gi = 0; gi < MAX_GROUP_MEMBERS; gi++) { if(members[gi]){ - distance = caster->DistNoRoot(*members[gi]); + distance = ComparativeDistance(caster->GetPosition(), members[gi]->GetPosition()); if(distance <= range2){ members[gi]->HealDamage(heal_amt, caster); members[gi]->SendHPUpdate(); @@ -1235,7 +1235,7 @@ void Group::BalanceHP(int32 penalty, float range, Mob* caster, int32 limit) for(; gi < MAX_GROUP_MEMBERS; gi++) { if(members[gi]){ - distance = caster->DistNoRoot(*members[gi]); + distance = ComparativeDistance(caster->GetPosition(), members[gi]->GetPosition()); if(distance <= range2){ dmgtaken_tmp = members[gi]->GetMaxHP() - members[gi]->GetHP(); From dc2534e38c66bd2a7286e7ccbc644b58f2ef6636 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 23:08:48 -0800 Subject: [PATCH 063/131] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/groups.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/groups.cpp b/zone/groups.cpp index a3e948fc1..dadddbb65 100644 --- a/zone/groups.cpp +++ b/zone/groups.cpp @@ -1253,7 +1253,7 @@ void Group::BalanceHP(int32 penalty, float range, Mob* caster, int32 limit) for(gi = 0; gi < MAX_GROUP_MEMBERS; gi++) { if(members[gi]){ - distance = caster->DistNoRoot(*members[gi]); + distance = ComparativeDistance(caster->GetPosition(), members[gi]->GetPosition()); if(distance <= range2){ if((members[gi]->GetMaxHP() - dmgtaken) < 1){ //this way the ability will never kill someone members[gi]->SetHP(1); //but it will come darn close From fa50ab8a18e36518f9caaa7f66bca8fb84e63332 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 23:12:25 -0800 Subject: [PATCH 064/131] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/groups.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/groups.cpp b/zone/groups.cpp index dadddbb65..35812dd88 100644 --- a/zone/groups.cpp +++ b/zone/groups.cpp @@ -1284,7 +1284,7 @@ void Group::BalanceMana(int32 penalty, float range, Mob* caster, int32 limit) for(; gi < MAX_GROUP_MEMBERS; gi++) { if(members[gi] && (members[gi]->GetMaxMana() > 0)){ - distance = caster->DistNoRoot(*members[gi]); + distance = ComparativeDistance(caster->GetPosition(), members[gi]->GetPosition()); if(distance <= range2){ manataken_tmp = members[gi]->GetMaxMana() - members[gi]->GetMana(); From a9c0920bc611a2ce728cf6e5b70a4f1ae97fccd5 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 23:15:06 -0800 Subject: [PATCH 065/131] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/groups.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/groups.cpp b/zone/groups.cpp index 35812dd88..1b26d47b4 100644 --- a/zone/groups.cpp +++ b/zone/groups.cpp @@ -1306,7 +1306,7 @@ void Group::BalanceMana(int32 penalty, float range, Mob* caster, int32 limit) for(gi = 0; gi < MAX_GROUP_MEMBERS; gi++) { if(members[gi]){ - distance = caster->DistNoRoot(*members[gi]); + distance = ComparativeDistance(caster->GetPosition(), members[gi]->GetPosition()); if(distance <= range2){ if((members[gi]->GetMaxMana() - manataken) < 1){ members[gi]->SetMana(1); From 80941d23bd61d40f61dea398b90b57dc827fbc3c Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 23:16:11 -0800 Subject: [PATCH 066/131] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/hate_list.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/hate_list.cpp b/zone/hate_list.cpp index b37b07f59..572781d06 100644 --- a/zone/hate_list.cpp +++ b/zone/hate_list.cpp @@ -592,7 +592,7 @@ void HateList::SpellCast(Mob *caster, uint32 spell_id, float range, Mob* ae_cent struct_HateList *h = (*iterator); if (range > 0) { - dist_targ = center->DistNoRoot(*h->entity_on_hatelist); + dist_targ = ComparativeDistance(center->GetPosition(), h->entity_on_hatelist->GetPosition()); if (dist_targ <= range && dist_targ >= min_range2) { id_list.push_back(h->entity_on_hatelist->GetID()); From 81f36675b397ef59807d532ae704e651ffa7b746 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 23:19:56 -0800 Subject: [PATCH 067/131] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/merc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/merc.cpp b/zone/merc.cpp index e50cb04c5..abbb481e4 100644 --- a/zone/merc.cpp +++ b/zone/merc.cpp @@ -1480,7 +1480,7 @@ void Merc::AI_Process() { if(IsMercCasterCombatRange(GetTarget())) atCombatRange = true; } - else if(DistNoRoot(*GetTarget()) <= meleeDistance) { + else if(ComparativeDistance(m_Position, GetTarget()->GetPosition()) <= meleeDistance) { atCombatRange = true; } From c5f38ee700803b459f8118c584d4ef0a91cd1097 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 23:26:22 -0800 Subject: [PATCH 068/131] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/merc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/merc.cpp b/zone/merc.cpp index abbb481e4..21ee850dc 100644 --- a/zone/merc.cpp +++ b/zone/merc.cpp @@ -1701,7 +1701,7 @@ void Merc::AI_Process() { if(follow) { - float dist = DistNoRoot(*follow); + float dist = ComparativeDistance(m_Position, follow->GetPosition()); float speed = GetRunspeed(); if(dist < GetFollowDistance() + 1000) From 9aa46a9af2367def529120905e4f6f34230a80a0 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 23:27:57 -0800 Subject: [PATCH 069/131] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/merc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/merc.cpp b/zone/merc.cpp index 21ee850dc..df81db149 100644 --- a/zone/merc.cpp +++ b/zone/merc.cpp @@ -1938,7 +1938,7 @@ bool Merc::AIDoSpellCast(uint16 spellid, Mob* tar, int32 mana_cost, uint32* oDon if (mercSpell.type & SpellType_Escape) { dist2 = 0; } else - dist2 = DistNoRoot(*tar); + dist2 = ComparativeDistance(m_Position, tar->GetPosition()); if (((((spells[spellid].targettype==ST_GroupTeleport && mercSpell.type==SpellType_Heal) || spells[spellid].targettype==ST_AECaster From 1bb4ff2d6a90c86461ecfb3e4157286922fef80f Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 23:30:18 -0800 Subject: [PATCH 070/131] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/merc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/merc.cpp b/zone/merc.cpp index df81db149..3ea3ac542 100644 --- a/zone/merc.cpp +++ b/zone/merc.cpp @@ -4201,7 +4201,7 @@ bool Merc::CheckConfidence() { AggroRange = AggroRange * AggroRange; - if(mob->DistNoRoot(*this) > AggroRange) continue; + if(ComparativeDistance(m_Position, mob->GetPosition()) > AggroRange) continue; CurrentCon = this->GetLevelCon(mob->GetLevel()); switch(CurrentCon) { From 0088d353d35abedbdd7a82869120ebe779ca22e0 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 23:31:57 -0800 Subject: [PATCH 071/131] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/merc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/merc.cpp b/zone/merc.cpp index 3ea3ac542..29310b872 100644 --- a/zone/merc.cpp +++ b/zone/merc.cpp @@ -5150,7 +5150,7 @@ bool Client::CheckCanHireMerc(Mob* merchant, uint32 template_id) { } //check for merchant too far away - if(DistNoRoot(*merchant) > USE_NPC_RANGE2) { + if(ComparativeDistance(m_Position, merchant->GetPosition()) > USE_NPC_RANGE2) { SendMercResponsePackets(18); return false; } From f047ed232db2d24becc7087c5c923e9ddd89ae4d Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 23:33:34 -0800 Subject: [PATCH 072/131] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/mob_ai.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/mob_ai.cpp b/zone/mob_ai.cpp index f6310801d..00db178eb 100644 --- a/zone/mob_ai.cpp +++ b/zone/mob_ai.cpp @@ -67,7 +67,7 @@ bool NPC::AICastSpell(Mob* tar, uint8 iChance, uint16 iSpellTypes) { dist2 = 0; //DistNoRoot(*this); //WTF was up with this... } else - dist2 = DistNoRoot(*tar); + dist2 = ComparativeDistance(m_Position, tar->GetPosition()); bool checked_los = false; //we do not check LOS until we are absolutely sure we need to, and we only do it once. From fccd767330b3350821b7829bbaa73803e63e9002 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 23:37:00 -0800 Subject: [PATCH 073/131] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/mob_ai.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/mob_ai.cpp b/zone/mob_ai.cpp index 00db178eb..8d518c95d 100644 --- a/zone/mob_ai.cpp +++ b/zone/mob_ai.cpp @@ -401,7 +401,7 @@ bool EntityList::AICheckCloseBeneficialSpells(NPC* caster, uint8 iChance, float if (t1 > iRange || t2 > iRange || t3 > iRange - || mob->DistNoRoot(*caster) > iRange2 + || ComparativeDistance(mob->GetPosition(), caster->GetPosition()) > iRange2 //this call should seem backwards: || !mob->CheckLosFN(caster) || mob->GetReverseFactionCon(caster) >= FACTION_KINDLY From 864e9ba8efed8afa2fee73afa9a0f43f0d3fcccd Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 23:48:44 -0800 Subject: [PATCH 074/131] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/mob_ai.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zone/mob_ai.cpp b/zone/mob_ai.cpp index 8d518c95d..17e1b5de6 100644 --- a/zone/mob_ai.cpp +++ b/zone/mob_ai.cpp @@ -997,7 +997,7 @@ void Client::AI_Process() if(owner == nullptr) return; - float dist = DistNoRoot(*owner); + float dist = ComparativeDistance(m_Position, owner->GetPosition()); if (dist >= 100) { float speed = dist >= 225 ? GetRunspeed() : GetWalkspeed(); @@ -1492,7 +1492,7 @@ void Mob::AI_Process() { //if(owner->IsClient()) // printf("Pet start pos: (%f, %f, %f)\n", GetX(), GetY(), GetZ()); - float dist = DistNoRoot(*owner); + float dist = ComparativeDistance(m_Position, owner->GetPosition()); if (dist >= 400) { float speed = GetWalkspeed(); From 37e4829ac4e00c1193e379e320aed00e88cb0454 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sat, 17 Jan 2015 23:55:16 -0800 Subject: [PATCH 075/131] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/mob_ai.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/mob_ai.cpp b/zone/mob_ai.cpp index 17e1b5de6..5f75fb81b 100644 --- a/zone/mob_ai.cpp +++ b/zone/mob_ai.cpp @@ -1547,7 +1547,7 @@ void Mob::AI_Process() { if (!follow) SetFollowID(0); else { - float dist2 = DistNoRoot(*follow); + float dist2 = ComparativeDistance(m_Position, follow->GetPosition()); int followdist = GetFollowDistance(); if (dist2 >= followdist) // Default follow distance is 100 From a0d012a6d64226a58ec9323c16fc45e2e6c731ee Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 00:48:51 -0800 Subject: [PATCH 076/131] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/mob_ai.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/mob_ai.cpp b/zone/mob_ai.cpp index 5f75fb81b..66cf41b21 100644 --- a/zone/mob_ai.cpp +++ b/zone/mob_ai.cpp @@ -1812,7 +1812,7 @@ void NPC::AI_DoMovement() { ClearFeignMemory(); moved=false; SetMoving(false); - if (GetTarget() == nullptr || DistNoRoot(*GetTarget()) >= 5*5 ) + if (GetTarget() == nullptr || ComparativeDistance(m_Position, GetTarget()->GetPosition()) >= 5*5 ) { SetHeading(m_GuardPoint.m_Heading); } else { From 9dcdd9354988c74c649419ba77fba70c2cb507e4 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 00:51:25 -0800 Subject: [PATCH 077/131] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/raids.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/raids.cpp b/zone/raids.cpp index b01d169fd..efd312bbf 100644 --- a/zone/raids.cpp +++ b/zone/raids.cpp @@ -489,7 +489,7 @@ void Raid::CastGroupSpell(Mob* caster, uint16 spellid, uint32 gid) else if(members[x].member != nullptr) { if(members[x].GroupNumber == gid){ - distance = caster->DistNoRoot(*members[x].member); + distance = ComparativeDistance(caster->GetPosition(), members[x].member->GetPosition()); if(distance <= range2){ caster->SpellOnTarget(spellid, members[x].member); #ifdef GROUP_BUFF_PETS From 263c9b6d3f8621e09dd581ee4333f7260e2476ee Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 00:53:24 -0800 Subject: [PATCH 078/131] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/raids.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/raids.cpp b/zone/raids.cpp index efd312bbf..e0ee94e1f 100644 --- a/zone/raids.cpp +++ b/zone/raids.cpp @@ -537,7 +537,7 @@ void Raid::HealGroup(uint32 heal_amt, Mob* caster, uint32 gid, float range) if(members[gi].member){ if(members[gi].GroupNumber == gid) { - distance = caster->DistNoRoot(*members[gi].member); + distance = ComparativeDistance(caster->GetPosition(), members[gi].member->GetPosition()); if(distance <= range2){ numMem += 1; } From 469b27890b93f526cbcd5d1a33dddb975ed277a2 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 00:57:34 -0800 Subject: [PATCH 079/131] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/raids.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/raids.cpp b/zone/raids.cpp index e0ee94e1f..4f197861a 100644 --- a/zone/raids.cpp +++ b/zone/raids.cpp @@ -551,7 +551,7 @@ void Raid::HealGroup(uint32 heal_amt, Mob* caster, uint32 gid, float range) if(members[gi].member){ if(members[gi].GroupNumber == gid) { - distance = caster->DistNoRoot(*members[gi].member); + distance = ComparativeDistance(caster->GetPosition(), members[gi].member->GetPosition()); if(distance <= range2){ members[gi].member->SetHP(members[gi].member->GetHP() + heal_amt); members[gi].member->SendHPUpdate(); From 9bd4007fd61950a29545b56e3b77d76b2eead70b Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 00:58:53 -0800 Subject: [PATCH 080/131] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/raids.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/raids.cpp b/zone/raids.cpp index 4f197861a..eabb1876d 100644 --- a/zone/raids.cpp +++ b/zone/raids.cpp @@ -581,7 +581,7 @@ void Raid::BalanceHP(int32 penalty, uint32 gid, float range, Mob* caster, int32 if(members[gi].member){ if(members[gi].GroupNumber == gid) { - distance = caster->DistNoRoot(*members[gi].member); + distance = ComparativeDistance(caster->GetPosition(), members[gi].member->GetPosition()); if(distance <= range2){ dmgtaken_tmp = members[gi].member->GetMaxHP() - members[gi].member->GetHP(); From dd52259dcf2284eb9480f62cedae888e3b98ccbe Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 01:00:00 -0800 Subject: [PATCH 081/131] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/raids.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/raids.cpp b/zone/raids.cpp index eabb1876d..df544520f 100644 --- a/zone/raids.cpp +++ b/zone/raids.cpp @@ -602,7 +602,7 @@ void Raid::BalanceHP(int32 penalty, uint32 gid, float range, Mob* caster, int32 if(members[gi].member){ if(members[gi].GroupNumber == gid) { - distance = caster->DistNoRoot(*members[gi].member); + distance = ComparativeDistance(caster->GetPosition(), members[gi].member->GetPosition()); if(distance <= range2){ if((members[gi].member->GetMaxHP() - dmgtaken) < 1){//this way the ability will never kill someone members[gi].member->SetHP(1); //but it will come darn close From a6ba08c5984ea470129bc54d29ac52098ca479f2 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 01:01:44 -0800 Subject: [PATCH 082/131] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/raids.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/raids.cpp b/zone/raids.cpp index df544520f..a4769e775 100644 --- a/zone/raids.cpp +++ b/zone/raids.cpp @@ -637,7 +637,7 @@ void Raid::BalanceMana(int32 penalty, uint32 gid, float range, Mob* caster, int3 if(members[gi].GroupNumber == gid) { if (members[gi].member->GetMaxMana() > 0) { - distance = caster->DistNoRoot(*members[gi].member); + distance = ComparativeDistance(caster->GetPosition(), members[gi].member->GetPosition()); if(distance <= range2){ manataken_tmp = members[gi].member->GetMaxMana() - members[gi].member->GetMana(); From dd70ee13a3aeb7aa5754583da8752325c330ccf8 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 01:04:37 -0800 Subject: [PATCH 083/131] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/raids.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/raids.cpp b/zone/raids.cpp index a4769e775..b81d1a3c6 100644 --- a/zone/raids.cpp +++ b/zone/raids.cpp @@ -660,7 +660,7 @@ void Raid::BalanceMana(int32 penalty, uint32 gid, float range, Mob* caster, int3 if(members[gi].member){ if(members[gi].GroupNumber == gid) { - distance = caster->DistNoRoot(*members[gi].member); + distance = ComparativeDistance(caster->GetPosition(), members[gi].member->GetPosition()); if(distance <= range2){ if((members[gi].member->GetMaxMana() - manataken) < 1){ members[gi].member->SetMana(1); From 3c1ee5970e9345e15460cecb9307bee18dd41923 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 01:07:35 -0800 Subject: [PATCH 084/131] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/raids.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/raids.cpp b/zone/raids.cpp index b81d1a3c6..3bed5af2e 100644 --- a/zone/raids.cpp +++ b/zone/raids.cpp @@ -791,7 +791,7 @@ void Raid::GroupBardPulse(Mob* caster, uint16 spellid, uint32 gid){ else if(members[z].member != nullptr) { if(members[z].GroupNumber == gid){ - distance = caster->DistNoRoot(*members[z].member); + distance = ComparativeDistance(caster->GetPosition(), members[z].member->GetPosition()); if(distance <= range2) { members[z].member->BardPulse(spellid, caster); #ifdef GROUP_BUFF_PETS From 5926c993be87175ad4095b87cd96bec9fc29d9d7 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 01:09:21 -0800 Subject: [PATCH 085/131] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/special_attacks.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/special_attacks.cpp b/zone/special_attacks.cpp index 5255ff1f6..3c7bf8875 100644 --- a/zone/special_attacks.cpp +++ b/zone/special_attacks.cpp @@ -769,7 +769,7 @@ void Client::RangedAttack(Mob* other, bool CanDoubleAttack) { float range = RangeItem->Range + AmmoItem->Range + GetRangeDistTargetSizeMod(GetTarget()); mlog(COMBAT__RANGED, "Calculated bow range to be %.1f", range); range *= range; - float dist = DistNoRoot(*other); + float dist = ComparativeDistance(m_Position, other->GetPosition()); if(dist > range) { mlog(COMBAT__RANGED, "Ranged attack out of range... client should catch this. (%f > %f).\n", dist, range); Message_StringID(13,TARGET_OUT_OF_RANGE);//Client enforces range and sends the message, this is a backup just incase. From 72bad478d6fb2656e50ad2da9489040b487ab246 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 01:12:15 -0800 Subject: [PATCH 086/131] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/special_attacks.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/special_attacks.cpp b/zone/special_attacks.cpp index 3c7bf8875..8c03d5dbc 100644 --- a/zone/special_attacks.cpp +++ b/zone/special_attacks.cpp @@ -1219,7 +1219,7 @@ void NPC::RangedAttack(Mob* other) min_range = static_cast(sa_min_range); max_range *= max_range; - if(DistNoRoot(*other) > max_range) + if(ComparativeDistance(m_Position, other->GetPosition()) > max_range) return; else if(DistNoRoot(*other) < (min_range * min_range)) return; From eac35f802aa111adcc4890450e034aeff99d681a Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 01:17:17 -0800 Subject: [PATCH 087/131] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/special_attacks.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/special_attacks.cpp b/zone/special_attacks.cpp index 8c03d5dbc..0414ce493 100644 --- a/zone/special_attacks.cpp +++ b/zone/special_attacks.cpp @@ -1221,7 +1221,7 @@ void NPC::RangedAttack(Mob* other) max_range *= max_range; if(ComparativeDistance(m_Position, other->GetPosition()) > max_range) return; - else if(DistNoRoot(*other) < (min_range * min_range)) + else if(ComparativeDistance(m_Position, other->GetPosition()) < (min_range * min_range)) return; if(!other || !IsAttackAllowed(other) || From 309240de43a1cd69b72e3c0cd9cc7662ee6b38fc Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 01:18:20 -0800 Subject: [PATCH 088/131] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/special_attacks.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/special_attacks.cpp b/zone/special_attacks.cpp index 0414ce493..b3014c7d9 100644 --- a/zone/special_attacks.cpp +++ b/zone/special_attacks.cpp @@ -1408,7 +1408,7 @@ void Client::ThrowingAttack(Mob* other, bool CanDoubleAttack) { //old was 51 float range = item->Range + GetRangeDistTargetSizeMod(other); mlog(COMBAT__RANGED, "Calculated bow range to be %.1f", range); range *= range; - float dist = DistNoRoot(*other); + float dist = ComparativeDistance(m_Position, other->GetPosition()); if(dist > range) { mlog(COMBAT__RANGED, "Throwing attack out of range... client should catch this. (%f > %f).\n", dist, range); Message_StringID(13,TARGET_OUT_OF_RANGE);//Client enforces range and sends the message, this is a backup just incase. From 53ad34b0604df7bbdbbb51f0cc1f3e46eece44b7 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 01:19:45 -0800 Subject: [PATCH 089/131] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/spells.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/spells.cpp b/zone/spells.cpp index a794d58a4..df3b286b3 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -2002,7 +2002,7 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16 } if(spell_target != nullptr && spell_target != this) { //casting a spell on somebody but ourself, make sure they are in range - float dist2 = DistNoRoot(*spell_target); + float dist2 = ComparativeDistance(m_Position, spell_target->GetPosition()); float range2 = range * range; float min_range2 = spells[spell_id].min_range * spells[spell_id].min_range; if(dist2 > range2) { From 94261700d96b0705f15854af59897aa2b05b686b Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 01:21:19 -0800 Subject: [PATCH 090/131] Removed a usage of Mob::DistNoRoot and used ComparativeDistance instead --- zone/spells.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/spells.cpp b/zone/spells.cpp index df3b286b3..96a1f87dd 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -2344,7 +2344,7 @@ bool Mob::ApplyNextBardPulse(uint16 spell_id, Mob *spell_target, uint16 slot) { range = GetActSpellRange(spell_id, spells[spell_id].range, true); if(spell_target != nullptr && spell_target != this) { //casting a spell on somebody but ourself, make sure they are in range - float dist2 = DistNoRoot(*spell_target); + float dist2 = ComparativeDistance(m_Position, spell_target->GetPosition()); float range2 = range * range; if(dist2 > range2) { //target is out of range. From 3ed365cd43ba1c318122c2ce64d8085e22ab0f65 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 01:22:59 -0800 Subject: [PATCH 091/131] Removed mob:DistNoRoot --- zone/mob.cpp | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/zone/mob.cpp b/zone/mob.cpp index 8b8a23747..91f1647b9 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -2274,16 +2274,6 @@ bool Mob::CanThisClassBlock(void) const } } -float Mob::DistNoRoot(const Mob &other) const { - float xDiff = other.m_Position.m_X - m_Position.m_X; - float yDiff = other.m_Position.m_Y - m_Position.m_Y; - float zDiff = other.m_Position.m_Z - m_Position.m_Z; - - return ( (xDiff * xDiff) - + (yDiff * yDiff) - + (zDiff * zDiff) ); -} - float Mob::DistNoRootNoZ(float x, float y) const { float xDiff = x - m_Position.m_X; float yDiff = y - m_Position.m_Y; From 121328b188a05d8b82fc8b1041e1e77cf7c618b9 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 01:27:47 -0800 Subject: [PATCH 092/131] Removed a usage of Mob::DistNoRootNoZ and used ComparativeDistanceNoZ instead --- zone/bot.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/bot.cpp b/zone/bot.cpp index 7326a9e42..8b632f43d 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -3354,7 +3354,7 @@ void Bot::AI_Process() { if(GetHasBeenSummoned()) { if(IsBotCaster() || IsBotArcher()) { if (AImovement_timer->Check()) { - if(!GetTarget() || (IsBotCaster() && !IsBotCasterCombatRange(GetTarget())) || (IsBotArcher() && IsArcheryRange(GetTarget())) || (DistNoRootNoZ(m_PreSummonLocation.m_X, m_PreSummonLocation.m_Y) < 10)) { + if(!GetTarget() || (IsBotCaster() && !IsBotCasterCombatRange(GetTarget())) || (IsBotArcher() && IsArcheryRange(GetTarget())) || (ComparativeDistanceNoZ(static_cast(m_Position), m_PreSummonLocation) < 10)) { if(GetTarget()) FaceTarget(GetTarget()); SetHasBeenSummoned(false); From baf53890b91f1be5a9aac12f96846ee40a3b9250 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 01:31:24 -0800 Subject: [PATCH 093/131] Removed a usage of Mob::DistNoRootNoZ and used ComparativeDistanceNoZ instead --- zone/client_packet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 8bd986225..2436c28fe 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -9182,7 +9182,7 @@ void Client::Handle_OP_LootRequest(const EQApplicationPacket *app) { SetLooting(ent->GetID()); //store the entity we are looting Corpse *ent_corpse = ent->CastToCorpse(); - if (DistNoRootNoZ(ent_corpse->GetX(), ent_corpse->GetY()) > 625) + if (ComparativeDistanceNoZ(m_Position, ent_corpse->GetPosition()) > 625) { Message(13, "Corpse too far away."); Corpse::SendLootReqErrorPacket(this); From d9b3d5972997457a6535ba39a72c3841135136f5 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 01:33:54 -0800 Subject: [PATCH 094/131] Removed a usage of Mob::DistNoRootNoZ and used ComparativeDistanceNoZ instead --- zone/mob_ai.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/mob_ai.cpp b/zone/mob_ai.cpp index 66cf41b21..d552a89ea 100644 --- a/zone/mob_ai.cpp +++ b/zone/mob_ai.cpp @@ -1129,7 +1129,7 @@ void Mob::AI_Process() { float tether_range = static_cast(GetSpecialAbilityParam(TETHER, 0)); tether_range = tether_range > 0.0f ? tether_range * tether_range : pAggroRange * pAggroRange; - if(DistNoRootNoZ(npcSpawnPoint.m_X, npcSpawnPoint.m_Y) > tether_range) { + if(ComparativeDistanceNoZ(m_Position, npcSpawnPoint) > tether_range) { GMMove(npcSpawnPoint.m_X, npcSpawnPoint.m_Y, npcSpawnPoint.m_Z, npcSpawnPoint.m_Heading); } } else if(GetSpecialAbility(LEASH)) { From 8619a0b518ddb28e3b2af61d90341de3d42ff987 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 01:38:30 -0800 Subject: [PATCH 095/131] Removed a usage of Mob::DistNoRootNoZ and used ComparativeDistanceNoZ instead --- zone/mob_ai.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/mob_ai.cpp b/zone/mob_ai.cpp index d552a89ea..9123b2f05 100644 --- a/zone/mob_ai.cpp +++ b/zone/mob_ai.cpp @@ -1136,7 +1136,7 @@ void Mob::AI_Process() { float leash_range = static_cast(GetSpecialAbilityParam(LEASH, 0)); leash_range = leash_range > 0.0f ? leash_range * leash_range : pAggroRange * pAggroRange; - if(DistNoRootNoZ(npcSpawnPoint.m_X, npcSpawnPoint.m_Y) > leash_range) { + if(ComparativeDistanceNoZ(m_Position, npcSpawnPoint) > leash_range) { GMMove(npcSpawnPoint.m_X, npcSpawnPoint.m_Y, npcSpawnPoint.m_Z, npcSpawnPoint.m_Heading); SetHP(GetMaxHP()); BuffFadeAll(); From 4431aa019742fa5d1910a7ed138ff91f75d1db36 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 01:39:17 -0800 Subject: [PATCH 096/131] Removed Mob::DistNoRootNoZ --- zone/mob.cpp | 7 ------- 1 file changed, 7 deletions(-) diff --git a/zone/mob.cpp b/zone/mob.cpp index 91f1647b9..57be8212b 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -2274,13 +2274,6 @@ bool Mob::CanThisClassBlock(void) const } } -float Mob::DistNoRootNoZ(float x, float y) const { - float xDiff = x - m_Position.m_X; - float yDiff = y - m_Position.m_Y; - - return ( (xDiff * xDiff) + (yDiff * yDiff) ); -} - float Mob::DistNoRootNoZ(const Mob &other) const { float xDiff = other.m_Position.m_X - m_Position.m_X; float yDiff = other.m_Position.m_Y - m_Position.m_Y; From 3290ddaffa7678d2518b5f91b7e4fc278f1ecfb9 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 01:43:33 -0800 Subject: [PATCH 097/131] Removed a usage of Mob::DistNoRootNoZ and used ComparativeDistanceNoZ instead --- zone/bot.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/bot.cpp b/zone/bot.cpp index 8b632f43d..7a4d4d5ab 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -3533,7 +3533,7 @@ void Bot::AI_Process() { return; } } - else if(!IsMoving() && GetClass() != ROGUE && (DistNoRootNoZ(*GetTarget()) < GetTarget()->GetSize())) { + else if(!IsMoving() && GetClass() != ROGUE && (ComparativeDistanceNoZ(m_Position, GetTarget()->GetPosition()) < GetTarget()->GetSize())) { // If we are not a rogue trying to backstab, let's try to adjust our melee range so we don't appear to be bunched up float newX = 0; float newY = 0; From 4ced8833732a258b3cf4f07553a993987f492a3e Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 01:51:36 -0800 Subject: [PATCH 098/131] Removed a usage of Mob::DistNoRootNoZ and used ComparativeDistanceNoZ instead --- zone/bot.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/bot.cpp b/zone/bot.cpp index 7a4d4d5ab..14a808d1a 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -3865,7 +3865,7 @@ void Bot::PetAIProcess() { return; } } - else if(botPet->DistNoRootNoZ(*botPet->GetTarget()) < botPet->GetTarget()->GetSize()) { + else if(ComparativeDistanceNoZ(botPet->GetPosition(), botPet->GetTarget()->GetPosition()) < botPet->GetTarget()->GetSize()) { // Let's try to adjust our melee range so we don't appear to be bunched up bool isBehindMob = false; bool moveBehindMob = false; From 0f1be1ecbf7b000b7abe58d65bd2a4925cd9c47b Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 01:54:54 -0800 Subject: [PATCH 099/131] Removed a usage of Mob::DistNoRootNoZ and used ComparativeDistanceNoZ instead --- zone/bot.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/bot.cpp b/zone/bot.cpp index 14a808d1a..a1cf363d2 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -10387,7 +10387,7 @@ bool Bot::IsArcheryRange(Mob *target) { range *= range; - float targetDistance = DistNoRootNoZ(*target); + float targetDistance = ComparativeDistanceNoZ(m_Position, target->GetPosition()); float minRuleDistance = RuleI(Combat, MinRangedAttackDist) * RuleI(Combat, MinRangedAttackDist); From c6b306068796bdd183ee7fb580a941e9e619b6ce Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 02:01:20 -0800 Subject: [PATCH 100/131] Removed a usage of Mob::DistNoRootNoZ and used ComparativeDistanceNoZ instead --- zone/bot.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/bot.cpp b/zone/bot.cpp index a1cf363d2..6e6201ee3 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -10411,7 +10411,7 @@ bool Bot::IsBotCasterCombatRange(Mob *target) { // half the max so the bot doesn't always stop at max range to allow combat movement range *= .5; - float targetDistance = DistNoRootNoZ(*target); + float targetDistance = ComparativeDistanceNoZ(m_Position, target->GetPosition()); if(targetDistance > range) result = false; From 4abe2fc6ffc4d965ea876b4a0ea20705f8a58151 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 02:03:44 -0800 Subject: [PATCH 101/131] Removed a usage of Mob::DistNoRootNoZ and used ComparativeDistanceNoZ instead --- zone/botspellsai.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/botspellsai.cpp b/zone/botspellsai.cpp index 68da92cae..c6c5e920c 100644 --- a/zone/botspellsai.cpp +++ b/zone/botspellsai.cpp @@ -1755,7 +1755,7 @@ Mob* Bot::GetFirstIncomingMobToMez(Bot* botCaster, BotSpell botSpell) { for(std::list::iterator itr = npc_list.begin(); itr != npc_list.end(); ++itr) { NPC* npc = *itr; - if(npc->DistNoRootNoZ(*botCaster) <= botCaster->GetActSpellRange(botSpell.SpellId, spells[botSpell.SpellId].range)) { + if(ComparativeDistanceNoZ(npc->GetPosition(), botCaster->GetPosition()) <= botCaster->GetActSpellRange(botSpell.SpellId, spells[botSpell.SpellId].range)) { if(!npc->IsMezzed()) { if(botCaster->HasGroup()) { Group* g = botCaster->GetGroup(); From 952459a31324b38ebf1122e91fafd006d9489955 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 02:05:09 -0800 Subject: [PATCH 102/131] Removed a usage of Mob::DistNoRootNoZ and used ComparativeDistanceNoZ instead --- zone/client.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/client.cpp b/zone/client.cpp index cee43648e..f10fb2a5d 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -994,7 +994,7 @@ void Client::ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_s CheckEmoteHail(GetTarget(), message); - if(DistNoRootNoZ(*GetTarget()) <= 200) { + if(ComparativeDistanceNoZ(m_Position, GetTarget()->GetPosition()) <= 200) { NPC *tar = GetTarget()->CastToNPC(); parse->EventNPC(EVENT_SAY, tar->CastToNPC(), this, message, language); From 7c7250ee5309374e4c72f7475f8fae95bc0185c0 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 02:07:01 -0800 Subject: [PATCH 103/131] Removed a usage of Mob::DistNoRootNoZ and used ComparativeDistanceNoZ instead --- zone/client.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/client.cpp b/zone/client.cpp index f10fb2a5d..bf0f21645 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -1006,7 +1006,7 @@ void Client::ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_s } } else { - if (DistNoRootNoZ(*GetTarget()) <= 200) { + if (ComparativeDistanceNoZ(m_Position, GetTarget()->GetPosition()) <= 200) { parse->EventNPC(EVENT_AGGRO_SAY, GetTarget()->CastToNPC(), this, message, language); } } From 095f5d25874e01470fe2e4145edbac4fe9bfc9e3 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 02:08:18 -0800 Subject: [PATCH 104/131] Removed a usage of Mob::DistNoRootNoZ and used ComparativeDistanceNoZ instead --- zone/client.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/client.cpp b/zone/client.cpp index bf0f21645..c6ef7eb7f 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -4553,7 +4553,7 @@ void Client::HandleLDoNOpen(NPC *target) return; } - if(DistNoRootNoZ(*target) > RuleI(Adventure, LDoNTrapDistanceUse)) + if(ComparativeDistanceNoZ(m_Position, target->GetPosition()) > RuleI(Adventure, LDoNTrapDistanceUse)) { LogFile->write(EQEmuLog::Debug, "%s tried to open %s but %s was out of range", GetName(), target->GetName(), target->GetName()); From c340fc9c39165a627dfeb10993fe7a0975c18fb9 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 02:10:42 -0800 Subject: [PATCH 105/131] Removed a usage of Mob::DistNoRootNoZ and used ComparativeDistanceNoZ instead --- zone/client.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/client.cpp b/zone/client.cpp index c6ef7eb7f..f640fa77b 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -6187,7 +6187,7 @@ void Client::DragCorpses() Mob *corpse = entity_list.GetMob(It->second); if (corpse && corpse->IsPlayerCorpse() && - (DistNoRootNoZ(*corpse) <= RuleR(Character, DragCorpseDistance))) + (ComparativeDistanceNoZ(m_Position, corpse->GetPosition()) <= RuleR(Character, DragCorpseDistance))) continue; if (!corpse || !corpse->IsPlayerCorpse() || From 261feabb7d776da52a4cb192251bc65a031cf120 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 02:14:59 -0800 Subject: [PATCH 106/131] Removed a usage of Mob::DistNoRootNoZ and used ComparativeDistanceNoZ instead --- zone/client_packet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 2436c28fe..65134cbb1 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -8707,7 +8707,7 @@ void Client::Handle_OP_LDoNDisarmTraps(const EQApplicationPacket *app) { if (HasSkill(SkillDisarmTraps)) { - if (DistNoRootNoZ(*target) > RuleI(Adventure, LDoNTrapDistanceUse)) + if (ComparativeDistanceNoZ(m_Position, target->GetPosition()) > RuleI(Adventure, LDoNTrapDistanceUse)) { Message(13, "%s is too far away.", target->GetCleanName()); return; From 46eab011f195e595b63c530721628464e56566d6 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 02:16:56 -0800 Subject: [PATCH 107/131] Removed a usage of Mob::DistNoRootNoZ and used ComparativeDistanceNoZ instead --- zone/client_packet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 65134cbb1..63b0f028c 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -8740,7 +8740,7 @@ void Client::Handle_OP_LDoNPickLock(const EQApplicationPacket *app) { if (HasSkill(SkillPickLock)) { - if (DistNoRootNoZ(*target) > RuleI(Adventure, LDoNTrapDistanceUse)) + if (ComparativeDistanceNoZ(m_Position, target->GetPosition()) > RuleI(Adventure, LDoNTrapDistanceUse)) { Message(13, "%s is too far away.", target->GetCleanName()); return; From 39e059e256663c9b5a79038cc102a2f12f4a4de0 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 02:21:13 -0800 Subject: [PATCH 108/131] Removed a usage of Mob::DistNoRootNoZ and used ComparativeDistanceNoZ instead --- zone/client_packet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 63b0f028c..54b935b46 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -8759,7 +8759,7 @@ void Client::Handle_OP_LDoNSenseTraps(const EQApplicationPacket *app) { if (HasSkill(SkillSenseTraps)) { - if (DistNoRootNoZ(*target) > RuleI(Adventure, LDoNTrapDistanceUse)) + if (ComparativeDistanceNoZ(m_Position, target->GetPosition()) > RuleI(Adventure, LDoNTrapDistanceUse)) { Message(13, "%s is too far away.", target->GetCleanName()); return; From 9dc24735a498b3d818413cfed16ef0a338a9420e Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 02:25:09 -0800 Subject: [PATCH 109/131] Removed a usage of Mob::DistNoRootNoZ and used ComparativeDistanceNoZ instead --- zone/client_packet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 54b935b46..ebd0dbe80 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -9923,7 +9923,7 @@ void Client::Handle_OP_PetCommands(const EQApplicationPacket *app) } if ((mypet->GetPetType() == petAnimation && GetAA(aaAnimationEmpathy) >= 2) || mypet->GetPetType() != petAnimation) { - if (GetTarget() != this && mypet->DistNoRootNoZ(*GetTarget()) <= (RuleR(Pets, AttackCommandRange)*RuleR(Pets, AttackCommandRange))) { + if (GetTarget() != this && ComparativeDistanceNoZ(mypet->GetPosition(), GetTarget()->GetPosition()) <= (RuleR(Pets, AttackCommandRange)*RuleR(Pets, AttackCommandRange))) { if (mypet->IsHeld()) { if (!mypet->IsFocused()) { mypet->SetHeld(false); //break the hold and guard if we explicitly tell the pet to attack. From 3f83bc77717fb5624338bfeba9c8e87361a435f3 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 02:41:11 -0800 Subject: [PATCH 110/131] Removed a usage of Mob::DistNoRootNoZ and used ComparativeDistanceNoZ instead --- zone/client_packet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index ebd0dbe80..88fb64e6d 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -9958,7 +9958,7 @@ void Client::Handle_OP_PetCommands(const EQApplicationPacket *app) } if ((mypet->GetPetType() == petAnimation && GetAA(aaAnimationEmpathy) >= 2) || mypet->GetPetType() != petAnimation) { - if (GetTarget() != this && mypet->DistNoRootNoZ(*GetTarget()) <= (RuleR(Pets, AttackCommandRange)*RuleR(Pets, AttackCommandRange))) { + if (GetTarget() != this && ComparativeDistanceNoZ(mypet->GetPosition(), GetTarget()->GetPosition()) <= (RuleR(Pets, AttackCommandRange)*RuleR(Pets, AttackCommandRange))) { zone->AddAggroMob(); mypet->AddToHateList(GetTarget(), 1); Message_StringID(MT_PetResponse, PET_ATTACKING, mypet->GetCleanName(), GetTarget()->GetCleanName()); From e5ee13bde044b11ab85c654a425d7cfee31a66e0 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 02:43:16 -0800 Subject: [PATCH 111/131] Removed a usage of Mob::DistNoRootNoZ and used ComparativeDistanceNoZ instead --- zone/command.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/command.cpp b/zone/command.cpp index 3c42d00fb..63b649448 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -4908,7 +4908,7 @@ void command_manaburn(Client *c, const Seperator *sep) c->Message(0, "#Manaburn needs a target."); else { int cur_level=c->GetAA(MANA_BURN);//ManaBurn ID - if (c->DistNoRootNoZ(*target) > 200) + if (ComparativeDistance(c->GetPosition(), target->GetPosition()) > 200) c->Message(0,"You are too far away from your target."); else { if(cur_level == 1) { From 83413178c2d87cb58d7264d7ea68ce66e35887b4 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 02:44:49 -0800 Subject: [PATCH 112/131] Removed a usage of Mob::DistNoRootNoZ and used ComparativeDistanceNoZ instead --- zone/command.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/command.cpp b/zone/command.cpp index 63b649448..82daf4e12 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -10305,7 +10305,7 @@ void command_disarmtrap(Client *c, const Seperator *sep) { if(c->HasSkill(SkillDisarmTraps)) { - if(c->DistNoRootNoZ(*target) > RuleI(Adventure, LDoNTrapDistanceUse)) + if(ComparativeDistanceNoZ(c->GetPosition(), target->GetPosition()) > RuleI(Adventure, LDoNTrapDistanceUse)) { c->Message(13, "%s is too far away.", target->GetCleanName()); return; From 9c3b66df934b77b119b2ac46b81ec6a4c94a3c6c Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 02:46:30 -0800 Subject: [PATCH 113/131] Removed a usage of Mob::DistNoRootNoZ and used ComparativeDistanceNoZ instead --- zone/command.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/command.cpp b/zone/command.cpp index 82daf4e12..6bfe124ba 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -10330,7 +10330,7 @@ void command_sensetrap(Client *c, const Seperator *sep) { if(c->HasSkill(SkillSenseTraps)) { - if(c->DistNoRootNoZ(*target) > RuleI(Adventure, LDoNTrapDistanceUse)) + if(ComparativeDistanceNoZ(c->GetPosition(), target->GetPosition()) > RuleI(Adventure, LDoNTrapDistanceUse)) { c->Message(13, "%s is too far away.", target->GetCleanName()); return; From e728280c5838ca4cd3733fcd16ea2f646f62bf0d Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 02:49:44 -0800 Subject: [PATCH 114/131] Removed a usage of Mob::DistNoRootNoZ and used ComparativeDistanceNoZ instead --- zone/command.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/command.cpp b/zone/command.cpp index 6bfe124ba..fe479848f 100644 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -10355,7 +10355,7 @@ void command_picklock(Client *c, const Seperator *sep) { if(c->HasSkill(SkillPickLock)) { - if(c->DistNoRootNoZ(*target) > RuleI(Adventure, LDoNTrapDistanceUse)) + if(ComparativeDistanceNoZ(c->GetPosition(), target->GetPosition()) > RuleI(Adventure, LDoNTrapDistanceUse)) { c->Message(13, "%s is too far away.", target->GetCleanName()); return; From 013518cdb5d5c07d8814abfe1ef1f07546ec2acf Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 02:59:27 -0800 Subject: [PATCH 115/131] Removed a usage of Mob::DistNoRootNoZ and used ComparativeDistanceNoZ instead --- zone/corpse.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/corpse.cpp b/zone/corpse.cpp index e1c519e89..a09b8513b 100644 --- a/zone/corpse.cpp +++ b/zone/corpse.cpp @@ -1328,7 +1328,7 @@ bool Corpse::Summon(Client* client, bool spell, bool CheckDistance) { client->Message(13, "That corpse is locked by a GM."); return false; } - if (!CheckDistance || (DistNoRootNoZ(*client) <= dist2)) { + if (!CheckDistance || (ComparativeDistanceNoZ(m_Position, client->GetPosition()) <= dist2)) { GMMove(client->GetX(), client->GetY(), client->GetZ()); is_corpse_changed = true; } From 8e112aac03cf35e25c830494220a465c949a10ff Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 03:03:46 -0800 Subject: [PATCH 116/131] Removed a usage of Mob::DistNoRootNoZ and used ComparativeDistanceNoZ instead --- zone/corpse.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/corpse.cpp b/zone/corpse.cpp index a09b8513b..b860f02fe 100644 --- a/zone/corpse.cpp +++ b/zone/corpse.cpp @@ -1343,7 +1343,7 @@ bool Corpse::Summon(Client* client, bool spell, bool CheckDistance) { std::list::iterator itr; for(itr = client->consent_list.begin(); itr != client->consent_list.end(); ++itr) { if(strcmp(this->GetOwnerName(), itr->c_str()) == 0) { - if (!CheckDistance || (DistNoRootNoZ(*client) <= dist2)) { + if (!CheckDistance || (ComparativeDistanceNoZ(m_Position, client->GetPosition()) <= dist2)) { GMMove(client->GetX(), client->GetY(), client->GetZ()); is_corpse_changed = true; } From e58a022e25d94f1a5a88f7368799b25bb4aeb78b Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 03:05:35 -0800 Subject: [PATCH 117/131] Removed a usage of Mob::DistNoRootNoZ and used ComparativeDistanceNoZ instead --- zone/effects.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/effects.cpp b/zone/effects.cpp index 1a988d500..c43b91168 100644 --- a/zone/effects.cpp +++ b/zone/effects.cpp @@ -674,7 +674,7 @@ void EntityList::AETaunt(Client* taunter, float range) zdiff *= -1; if (zdiff < 10 && taunter->IsAttackAllowed(them) - && taunter->DistNoRootNoZ(*them) <= range) { + && ComparativeDistanceNoZ(taunter->GetPosition(), them->GetPosition()) <= range) { if (taunter->CheckLosFN(them)) { taunter->Taunt(them, true); } From f33eb9f8f329bb25db744fa39ba6023245c324e0 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 03:09:08 -0800 Subject: [PATCH 118/131] Removed a usage of Mob::DistNoRootNoZ and used ComparativeDistanceNoZ instead --- zone/entity.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/entity.cpp b/zone/entity.cpp index 2b0551a26..6ec20832e 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -1584,7 +1584,7 @@ Corpse *EntityList::GetCorpseByOwnerWithinRange(Client *client, Mob *center, int auto it = corpse_list.begin(); while (it != corpse_list.end()) { if (it->second->IsPlayerCorpse()) - if (center->DistNoRootNoZ(*it->second) < range && + if (ComparativeDistanceNoZ(center->GetPosition(), it->second->GetPosition()) < range && strcasecmp(it->second->GetOwnerName(), client->GetName()) == 0) return it->second; ++it; From f54c698ffe6b5782d389c4e2aa09e6e8d55ffc84 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 03:12:08 -0800 Subject: [PATCH 119/131] Removed a usage of Mob::DistNoRootNoZ and used ComparativeDistanceNoZ instead --- zone/hate_list.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/hate_list.cpp b/zone/hate_list.cpp index 572781d06..ad49b00fd 100644 --- a/zone/hate_list.cpp +++ b/zone/hate_list.cpp @@ -158,7 +158,7 @@ Mob* HateList::GetClosestEntOnHateList(Mob *hater) { auto iterator = list.begin(); while (iterator != list.end()) { - this_distance = (*iterator)->entity_on_hatelist->DistNoRootNoZ(*hater); + this_distance = ComparativeDistanceNoZ((*iterator)->entity_on_hatelist->GetPosition(), hater->GetPosition()); if ((*iterator)->entity_on_hatelist != nullptr && this_distance <= close_distance) { close_distance = this_distance; close_entity = (*iterator)->entity_on_hatelist; From 90e011ad997edba06e8065a653f925165974aaff Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 03:24:40 -0800 Subject: [PATCH 120/131] Removed a usage of Mob::DistNoRootNoZ and used ComparativeDistanceNoZ instead --- zone/merc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/merc.cpp b/zone/merc.cpp index 29310b872..25d0aec76 100644 --- a/zone/merc.cpp +++ b/zone/merc.cpp @@ -1318,7 +1318,7 @@ bool Merc::IsMercCasterCombatRange(Mob *target) { // half the max so the merc doesn't always stop at max range to allow combat movement range *= .5; - float targetDistance = DistNoRootNoZ(*target); + float targetDistance = ComparativeDistanceNoZ(m_Position, target->GetPosition()); if(targetDistance > range) result = false; From 69a6a6f3f83e3843f33daf33125e47b3a4461730 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 03:25:54 -0800 Subject: [PATCH 121/131] Removed a usage of Mob::DistNoRootNoZ and used ComparativeDistanceNoZ instead --- zone/merc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/merc.cpp b/zone/merc.cpp index 25d0aec76..a19021082 100644 --- a/zone/merc.cpp +++ b/zone/merc.cpp @@ -1513,7 +1513,7 @@ void Merc::AI_Process() { return; } } - else if(!IsMoving() && GetClass() != ROGUE && (DistNoRootNoZ(*GetTarget()) < GetTarget()->GetSize())) + else if(!IsMoving() && GetClass() != ROGUE && (ComparativeDistanceNoZ(m_Position, GetTarget()->GetPosition()) < GetTarget()->GetSize())) { // If we are not a rogue trying to backstab, let's try to adjust our melee range so we don't appear to be bunched up float newX = 0; From 99783fd871004f1dae945d2412ee88687ac75f64 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 03:31:07 -0800 Subject: [PATCH 122/131] Removed a usage of Mob::DistNoRootNoZ and used ComparativeDistanceNoZ instead --- zone/merc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/merc.cpp b/zone/merc.cpp index a19021082..bb549f830 100644 --- a/zone/merc.cpp +++ b/zone/merc.cpp @@ -2435,7 +2435,7 @@ void Merc::CheckHateList() { if(MercOwner && MercOwner->GetTarget() && MercOwner->GetTarget()->IsNPC() && (MercOwner->GetTarget()->GetHateAmount(MercOwner) || MercOwner->CastToClient()->AutoAttackEnabled()) && IsAttackAllowed(MercOwner->GetTarget())) { float range = g->HasRole(MercOwner, RolePuller) ? RuleI(Mercs, AggroRadiusPuller) : RuleI(Mercs, AggroRadius); range = range * range; - if(MercOwner->GetTarget()->DistNoRootNoZ(*this) < range) { + if(ComparativeDistanceNoZ(m_Position, MercOwner->GetTarget()->GetPosition()) < range) { AddToHateList(MercOwner->GetTarget(), 1); } } From 517c0846578b5208a1e40e4160b1f6e5982ea172 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 03:32:28 -0800 Subject: [PATCH 123/131] Removed a usage of Mob::DistNoRootNoZ and used ComparativeDistanceNoZ instead --- zone/merc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/merc.cpp b/zone/merc.cpp index bb549f830..ffc3075ff 100644 --- a/zone/merc.cpp +++ b/zone/merc.cpp @@ -2445,7 +2445,7 @@ void Merc::CheckHateList() { for(std::list::iterator itr = npc_list.begin(); itr != npc_list.end(); ++itr) { NPC* npc = *itr; - float dist = npc->DistNoRootNoZ(*this); + float dist = ComparativeDistanceNoZ(m_Position, npc->GetPosition()); int radius = RuleI(Mercs, AggroRadius); radius *= radius; if(dist <= radius) { From dc275b3b1e2225f62207c3dd975918a1a7a71ab8 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 03:35:20 -0800 Subject: [PATCH 124/131] Removed a usage of Mob::DistNoRootNoZ and used ComparativeDistanceNoZ instead --- zone/merc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/merc.cpp b/zone/merc.cpp index ffc3075ff..9031f2322 100644 --- a/zone/merc.cpp +++ b/zone/merc.cpp @@ -2499,7 +2499,7 @@ bool Merc::CheckAENuke(Merc* caster, Mob* tar, uint16 spell_id, uint8 &numTarget for(std::list::iterator itr = npc_list.begin(); itr != npc_list.end(); ++itr) { NPC* npc = *itr; - if(npc->DistNoRootNoZ(*tar) <= spells[spell_id].aoerange * spells[spell_id].aoerange) { + if(ComparativeDistanceNoZ(npc->GetPosition(), tar->GetPosition()) <= spells[spell_id].aoerange * spells[spell_id].aoerange) { if(!npc->IsMezzed()) { numTargets++; } From 8a1e03ced46ff7a7e0909a1bfdc33f88e105526e Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 03:37:26 -0800 Subject: [PATCH 125/131] Removed a usage of Mob::DistNoRootNoZ and used ComparativeDistanceNoZ instead --- zone/merc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/merc.cpp b/zone/merc.cpp index 9031f2322..4776c353a 100644 --- a/zone/merc.cpp +++ b/zone/merc.cpp @@ -2457,7 +2457,7 @@ void Merc::CheckHateList() { if(!hate_list.IsEntOnHateList(npc)) { float range = g->HasRole(groupMember, RolePuller) ? RuleI(Mercs, AggroRadiusPuller) : RuleI(Mercs, AggroRadius); range *= range; - if(npc->DistNoRootNoZ(*this) < range) { + if(ComparativeDistanceNoZ(m_Position, npc->GetPosition()) < range) { hate_list.AddEntToHateList(npc, 1); } } From ae4e1ef0d00bbebc8f61f2ed6e74905f6ca97170 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 03:44:08 -0800 Subject: [PATCH 126/131] Removed a usage of Mob::DistNoRootNoZ and used ComparativeDistanceNoZ instead --- zone/merc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/merc.cpp b/zone/merc.cpp index 4776c353a..700287ffe 100644 --- a/zone/merc.cpp +++ b/zone/merc.cpp @@ -4098,7 +4098,7 @@ bool Merc::CheckAETaunt() { for(std::list::iterator itr = npc_list.begin(); itr != npc_list.end(); ++itr) { NPC* npc = *itr; - float dist = npc->DistNoRootNoZ(*this); + float dist = ComparativeDistanceNoZ(m_Position, npc->GetPosition()); int range = GetActSpellRange(mercSpell.spellid, spells[mercSpell.spellid].range); range *= range; From 97d7d69623c83f7de30d18066cf2c9f443528e2b Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 03:49:40 -0800 Subject: [PATCH 127/131] Removed a usage of Mob::DistNoRootNoZ and used ComparativeDistanceNoZ instead --- zone/mob_ai.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/mob_ai.cpp b/zone/mob_ai.cpp index 9123b2f05..3902ee072 100644 --- a/zone/mob_ai.cpp +++ b/zone/mob_ai.cpp @@ -622,7 +622,7 @@ void Client::AI_SpellCast() if(!targ) return; - float dist = DistNoRootNoZ(*targ); + float dist = ComparativeDistanceNoZ(m_Position, targ->GetPosition()); std::vector valid_spells; std::vector slots; From 2ccac250045430e474aea8215ac76b4fa39eafc5 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 03:52:17 -0800 Subject: [PATCH 128/131] Removed a usage of Mob::DistNoRootNoZ and used ComparativeDistanceNoZ instead --- zone/perl_client.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/perl_client.cpp b/zone/perl_client.cpp index df0a48e69..46b3b761a 100644 --- a/zone/perl_client.cpp +++ b/zone/perl_client.cpp @@ -5963,7 +5963,7 @@ XS(XS_Client_SilentMessage) Perl_croak(aTHX_ "THIS is NULL, avoiding crash."); if(THIS->GetTarget() != NULL){ if(THIS->GetTarget()->IsNPC()){ - if (THIS->DistNoRootNoZ(*THIS->GetTarget()) <= 200) { + if (ComparativeDistanceNoZ(THIS->GetPosition(), THIS->GetTarget()->GetPosition()) <= 200) { if(THIS->GetTarget()->CastToNPC()->IsMoving() && !THIS->GetTarget()->CastToNPC()->IsOnHatelist(THIS->GetTarget())) THIS->GetTarget()->CastToNPC()->PauseWandering(RuleI(NPC, SayPauseTimeInSec)); THIS->ChannelMessageReceived(8, 0, 100, SvPV_nolen(ST(1))); From 0aefc0453db4a3db271dc8d2d66b00ba6ce25fa6 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 03:54:49 -0800 Subject: [PATCH 129/131] Removed Mob::DistNoRootNoZ --- zone/mob.cpp | 7 ------- 1 file changed, 7 deletions(-) diff --git a/zone/mob.cpp b/zone/mob.cpp index 57be8212b..238859062 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -2274,13 +2274,6 @@ bool Mob::CanThisClassBlock(void) const } } -float Mob::DistNoRootNoZ(const Mob &other) const { - float xDiff = other.m_Position.m_X - m_Position.m_X; - float yDiff = other.m_Position.m_Y - m_Position.m_Y; - - return ( (xDiff * xDiff) + (yDiff * yDiff) ); -} - float Mob::GetReciprocalHeading(Mob* target) { float Result = 0; From cc802f2e74ece6f6cbc5ef52bdc4d60ed364e25b Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 12:22:37 -0800 Subject: [PATCH 130/131] Added 'GetReciprocalHeading' to position.cpp/h --- zone/position.cpp | 30 ++++++++++++++++++++++++++++++ zone/position.h | 3 +++ 2 files changed, 33 insertions(+) diff --git a/zone/position.cpp b/zone/position.cpp index 63c5b034f..38b92c77e 100644 --- a/zone/position.cpp +++ b/zone/position.cpp @@ -222,3 +222,33 @@ bool IsWithinAxisAlignedBox(const xy_location &position, const xy_location &mini return xcheck && ycheck; } + +/** +* Gives the heading directly 180 degrees from the +* current heading. +* Takes the EQfloat from the xyz_heading and returns +* an EQFloat. +*/ +float GetReciprocalHeading(const xyz_heading& point1) { + return GetReciprocalHeading(point1.m_Heading); +} + +/** +* Gives the heading directly 180 degrees from the +* current heading. +* Takes an EQfloat and returns an EQFloat. +*/ +float GetReciprocalHeading(const float heading) { + float result = 0; + + // Convert to radians + float h = (heading / 256.0f) * 6.283184f; + + // Calculate the reciprocal heading in radians + result = h + 3.141592f; + + // Convert back to eq heading from radians + result = (result / 6.283184f) * 256.0f; + + return result; +} \ No newline at end of file diff --git a/zone/position.h b/zone/position.h index 30f8fcb1c..f422a5247 100644 --- a/zone/position.h +++ b/zone/position.h @@ -99,4 +99,7 @@ float Distance(const xyz_heading& point1, const xyz_heading& point2); float DistanceNoZ(const xyz_heading& point1, const xyz_heading& point2); float ComparativeDistanceNoZ(const xyz_heading& point1, const xyz_heading& point2); +float GetReciprocalHeading(const xyz_heading& point1); +float GetReciprocalHeading(const float heading); + #endif From 53862713f9e3cbef55391412006ad769a9f38d15 Mon Sep 17 00:00:00 2001 From: Arthur Ice Date: Sun, 18 Jan 2015 12:38:27 -0800 Subject: [PATCH 131/131] Switched to position based GetReciprocalHeading instead of Mob::GetReciprocalHeading --- zone/mob.cpp | 6 +++--- zone/mob.h | 4 ---- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/zone/mob.cpp b/zone/mob.cpp index 238859062..b9fe82ea1 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -2273,7 +2273,7 @@ bool Mob::CanThisClassBlock(void) const return(CastToClient()->HasSkill(SkillBlock)); } } - +/* float Mob::GetReciprocalHeading(Mob* target) { float Result = 0; @@ -2290,7 +2290,7 @@ float Mob::GetReciprocalHeading(Mob* target) { return Result; } - +*/ bool Mob::PlotPositionAroundTarget(Mob* target, float &x_dest, float &y_dest, float &z_dest, bool lookForAftArc) { bool Result = false; @@ -2298,7 +2298,7 @@ bool Mob::PlotPositionAroundTarget(Mob* target, float &x_dest, float &y_dest, fl float look_heading = 0; if(lookForAftArc) - look_heading = GetReciprocalHeading(target); + look_heading = GetReciprocalHeading(target->GetPosition()); else look_heading = target->GetHeading(); diff --git a/zone/mob.h b/zone/mob.h index c78eee65c..09c9bf56f 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -511,10 +511,6 @@ public: void ShowStats(Client* client); void ShowBuffs(Client* client); void ShowBuffList(Client* client); - float DistNoRoot(const Mob &) const; - float DistNoRootNoZ(float x, float y) const; - float DistNoRootNoZ(const Mob &) const; - static float GetReciprocalHeading(Mob* target); bool PlotPositionAroundTarget(Mob* target, float &x_dest, float &y_dest, float &z_dest, bool lookForAftArc = true);