aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjackpoz <giacomopoz@gmail.com>2015-08-24 14:52:03 +0200
committerjackpoz <giacomopoz@gmail.com>2015-08-24 14:52:18 +0200
commitf50df728201849ee7185d33c5a061c91e781c8de (patch)
tree947aff3af5ae1cc017c36e9460660741ef04814e /src
parent405f823f68621352e48810c33f1f9dbd36904ff8 (diff)
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
Diffstat (limited to 'src')
-rw-r--r--src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp15
1 files changed, 6 insertions, 9 deletions
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<uint8> 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]);
});
}