Quick fix for GetAITarget, this really should be cleaned up

This commit is contained in:
Foereaper
2020-09-12 18:23:27 +02:00
parent 126976b647
commit 23daeb6a0d

View File

@@ -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<Unit*> 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