Misc/Util: Add a template function for returning a random element from any container
This commit is contained in:
@@ -1075,9 +1075,7 @@ void LootTemplate::LootGroup::Process(Loot& loot, uint16 lootMode) const
|
||||
if (item == NULL && !EqualPossibleDrops.empty()) // If nothing selected yet - an item is taken from equal-chanced part
|
||||
{
|
||||
itemSource = 2;
|
||||
itr = EqualPossibleDrops.begin();
|
||||
std::advance(itr, irand(0, EqualPossibleDrops.size()-1));
|
||||
item = &*itr;
|
||||
item = const_cast<LootStoreItem*>(&SelectRandomContainerElement(EqualPossibleDrops));
|
||||
}
|
||||
// finish rolling
|
||||
|
||||
|
||||
Reference in New Issue
Block a user