Remove AUTO_VAR macro and _toString function (#592)

This commit is contained in:
void_17
2026-03-06 02:11:18 +07:00
committed by GitHub
parent 7d6658fe5b
commit 55231bb8d3
294 changed files with 5067 additions and 5773 deletions

View File

@@ -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;