fix(Core/AI): validate stored targets (#12489)

Co-authored-by: Meji <meji46@users.noreply.github.com>
Co-authored-by: Ariel Silva <ariel-@users.noreply.github.com>
Co-authored-by: Shauren <shauren.trinity@gmail.com>

Co-authored-by: Meji <meji46@users.noreply.github.com>
Co-authored-by: Ariel Silva <ariel-@users.noreply.github.com>
Co-authored-by: Shauren <shauren.trinity@gmail.com>
This commit is contained in:
Nefertumm
2022-07-24 13:06:11 -03:00
committed by GitHub
parent 5bcc54a617
commit f0777d1fd3
4 changed files with 98 additions and 23 deletions

View File

@@ -80,7 +80,7 @@ public:
{
// insert or replace
_storedTargets.erase(id);
_storedTargets.emplace(id, ObjectGuidVector(GetBaseObject(), targets));
_storedTargets.emplace(id, ObjectGuidVector(targets));
}
bool IsSmart(Creature* c = nullptr)
@@ -112,11 +112,11 @@ public:
return smart;
}
ObjectVector const* GetStoredTargetVector(uint32 id) const
ObjectVector const* GetStoredTargetVector(uint32 id, WorldObject const& ref) const
{
auto itr = _storedTargets.find(id);
if (itr != _storedTargets.end())
return itr->second.GetObjectVector();
return itr->second.GetObjectVector(ref);
return nullptr;
}