From f50df728201849ee7185d33c5a061c91e781c8de Mon Sep 17 00:00:00 2001 From: jackpoz Date: Mon, 24 Aug 2015 14:52:03 +0200 Subject: Scripts/VioletHold: Fix crash in Xevozz boss fight Fix crash happening during Xevozz boss fight caused by passing a local list by reference to a lambda expression Closes #15345 --- src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'src/server/scripts') diff --git a/src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp b/src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp index 5e3c7014239..93e74aaca71 100644 --- a/src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp +++ b/src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp @@ -155,19 +155,16 @@ class boss_xevozz : public CreatureScript std::list summonSpells = { 0, 1, 2 }; - auto it = summonSpells.begin(); - std::advance(it, urand(0, summonSpells.size() - 1)); - DoCast(me, EtherealSphereSummonSpells[*it]); - it = summonSpells.erase(it); + uint8 spell = Trinity::Containers::SelectRandomContainerElement(summonSpells); + DoCast(me, EtherealSphereSummonSpells[spell]); + summonSpells.remove(spell); if (IsHeroic()) { - task.Schedule(Milliseconds(2500), [this, &it, &summonSpells](TaskContext /*task*/) + spell = Trinity::Containers::SelectRandomContainerElement(summonSpells); + task.Schedule(Milliseconds(2500), [this, spell](TaskContext /*task*/) { - it = summonSpells.begin(); - std::advance(it, urand(0, summonSpells.size() - 1)); - DoCast(me, EtherealSphereHeroicSummonSpells[*it]); - it = summonSpells.erase(it); + DoCast(me, EtherealSphereHeroicSummonSpells[spell]); }); } -- cgit v1.2.3