mirror of
https://github.com/smartcmd/MinecraftConsoles.git
synced 2026-05-12 04:03:53 +00:00
Remove AUTO_VAR macro and _toString function (#592)
This commit is contained in:
parent
7d6658fe5b
commit
55231bb8d3
294 changed files with 5067 additions and 5773 deletions
|
|
@ -4,9 +4,9 @@
|
|||
int WeighedRandom::getTotalWeight(vector<WeighedRandomItem *> *items)
|
||||
{
|
||||
int totalWeight = 0;
|
||||
for( AUTO_VAR(it, items->begin()); it != items->end(); it++ )
|
||||
for( const auto& item : *items)
|
||||
{
|
||||
totalWeight += (*it)->randomWeight;
|
||||
totalWeight += item->randomWeight;
|
||||
}
|
||||
return totalWeight;
|
||||
}
|
||||
|
|
@ -20,12 +20,12 @@ WeighedRandomItem *WeighedRandom::getRandomItem(Random *random, vector<WeighedRa
|
|||
|
||||
int selection = random->nextInt(totalWeight);
|
||||
|
||||
for( AUTO_VAR(it, items->begin()); it != items->end(); it++ )
|
||||
for(const auto& item : *items)
|
||||
{
|
||||
selection -= (*it)->randomWeight;
|
||||
selection -= item->randomWeight;
|
||||
if (selection < 0)
|
||||
{
|
||||
return *it;
|
||||
return item;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue