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