Misc/Util: Add a template function for returning a random element from any container

This commit is contained in:
Shocker
2011-09-15 21:28:40 +03:00
parent 8504a0107e
commit 7afb179185
23 changed files with 44 additions and 96 deletions
@@ -5748,9 +5748,7 @@ void AuraEffect::HandlePeriodicDummyAuraTick(Unit* target, Unit* caster) const
if (targets.empty())
return;
UnitList::const_iterator itr = targets.begin();
std::advance(itr, rand()%targets.size());
Unit* spellTarget = *itr;
Unit* spellTarget = SelectRandomContainerElement(targets);
target->CastSpell(spellTarget, 57840, true);
target->CastSpell(spellTarget, 57841, true);