From 13ad5e4b46ff4a2fa3e78debacfdab0b9df56519 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Tue, 30 Jan 2018 12:53:58 -0500 Subject: [PATCH] Lets ignore Z on distance hate removal until pathing doesn't suck --- zone/hate_list.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/zone/hate_list.cpp b/zone/hate_list.cpp index fe0ca4a04..5af9da7d9 100644 --- a/zone/hate_list.cpp +++ b/zone/hate_list.cpp @@ -657,6 +657,8 @@ void HateList::RemoveStaleEntries(int time_ms, float dist) auto cur_time = Timer::GetCurrentTime(); + auto dist2 = dist * dist; + while (it != list.end()) { auto m = (*it)->entity_on_hatelist; if (m) { @@ -665,7 +667,7 @@ void HateList::RemoveStaleEntries(int time_ms, float dist) if (cur_time - (*it)->last_modified > time_ms) remove = true; - if (!remove && hate_owner->CalculateDistance(m->GetX(), m->GetY(), m->GetZ()) > dist) { + if (!remove && DistanceSquaredNoZ(hate_owner->GetPosition(), m->GetPosition()) > dist2) { (*it)->oor_count++; if ((*it)->oor_count == 2) remove = true;