diff options
author | Elron103 <scarymovie87@gmx.de> | 2012-09-02 00:19:13 +0200 |
---|---|---|
committer | Elron103 <scarymovie87@gmx.de> | 2012-09-02 00:19:13 +0200 |
commit | 46852a3808955ab3fb5d3044c9f0c85d8223c986 (patch) | |
tree | b1c2f2ce096ac1ba313cc9411f05b80a6bd8515c /src | |
parent | a7dd289b04e3a9d0337fb5b6db3fc7a70f670933 (diff) |
Core/Scripting: Fix DoAction function of SummonList incorrectly removing entries in SummonList
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/AI/ScriptedAI/ScriptedCreature.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.h b/src/server/game/AI/ScriptedAI/ScriptedCreature.h index ba0a94d2590..aa46d555b7d 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedCreature.h +++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.h @@ -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) |