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)
|
template <class Predicate> void DoAction(int32 info, Predicate& predicate, uint16 max = 0)
|
||||||
{
|
{
|
||||||
Trinity::Containers::RandomResizeList<uint64, Predicate>(*this, predicate, max);
|
// We need to use a copy of SummonList here, otherwise original SummonList would be modified
|
||||||
for (iterator i = begin(); i != end(); )
|
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++);
|
Creature* summon = Unit::GetCreature(*me, *i++);
|
||||||
if (summon && summon->IsAIEnabled)
|
if (summon && summon->IsAIEnabled)
|
||||||
|
|||||||
Reference in New Issue
Block a user