mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-23 02:25:38 +01:00
Merge pull request #7613 from Elron103/pull-requests
Core/Scripting: Fix DoAction function of SummonList incorrectly removing entries in SummonList
This commit is contained in:
@@ -41,8 +41,10 @@ class SummonList : public std::list<uint64>
|
||||
|
||||
template <class Predicate> void DoAction(int32 info, Predicate& predicate, uint16 max = 0)
|
||||
{
|
||||
Trinity::Containers::RandomResizeList<uint64, Predicate>(*this, predicate, max);
|
||||
for (iterator i = begin(); i != end(); )
|
||||
// We need to use a copy of SummonList here, otherwise original SummonList would be modified
|
||||
std::list<uint64> listCopy = *this;
|
||||
Trinity::Containers::RandomResizeList<uint64, Predicate>(listCopy, predicate, max);
|
||||
for (iterator i = listCopy.begin(); i != listCopy.end(); )
|
||||
{
|
||||
Creature* summon = Unit::GetCreature(*me, *i++);
|
||||
if (summon && summon->IsAIEnabled)
|
||||
|
||||
Reference in New Issue
Block a user