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
+1 -4
View File
@@ -934,11 +934,8 @@ bool LFGMgr::CheckCompatibility(LfgGuidList check, LfgProposal*& pProposal)
// Select a random dungeon from the compatible list
// TODO - Select the dungeon based on group item Level, not just random
LfgDungeonSet::const_iterator itDungeon = compatibleDungeons.begin();
std::advance(itDungeon, urand(0, compatibleDungeons.size() - 1));
// Create a new proposal
pProposal = new LfgProposal(*itDungeon);
pProposal = new LfgProposal(SelectRandomContainerElement(compatibleDungeons));
pProposal->cancelTime = time_t(time(NULL)) + LFG_TIME_PROPOSAL;
pProposal->state = LFG_PROPOSAL_INITIATING;
pProposal->queues = check;