From 23daeb6a0d5c08212f5e29816823ed62145c2552 Mon Sep 17 00:00:00 2001 From: Foereaper Date: Sat, 12 Sep 2020 18:23:27 +0200 Subject: [PATCH] Quick fix for GetAITarget, this really should be cleaned up --- CreatureMethods.h | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/CreatureMethods.h b/CreatureMethods.h index 4bef86a..83a5c5b 100644 --- a/CreatureMethods.h +++ b/CreatureMethods.h @@ -713,27 +713,28 @@ namespace LuaCreature #ifdef CMANGOS ThreatList const& threatlist = creature->getThreatManager().getThreatList(); -#endif -#ifdef MANGOS +#elif MANGOS ThreatList const& threatlist = creature->GetThreatManager().getThreatList(); -#endif -#ifdef TRINITY - auto const& threatlist = creature->GetThreatManager().GetThreatenedByMeList(); -#endif -#ifdef AZEROTHCORE +#elif TRINITY + auto const& threatlist = creature->GetThreatManager().GetSortedThreatList(); +#elif AZEROTHCORE auto const& threatlist = creature->getThreatManager().getThreatList(); #endif - +#ifndef TRINITY if (threatlist.empty()) return 1; if (position >= threatlist.size()) return 1; - +#endif std::list targetList; - for (auto itr = threatlist.begin(); itr != threatlist.end(); ++itr) - { #ifdef TRINITY - Unit* target = itr->second->GetOwner(); + for (ThreatReference const* itr : threatlist) +#else + for (auto itr = threatlist.begin(); itr != threatlist.end(); ++itr) +#endif + { +#ifdef TRINITY + Unit* target = itr->GetVictim(); #else Unit* target = (*itr)->getTarget(); #endif