mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/4jcraft.git
synced 2026-06-16 18:32:02 +00:00
refactor: expand AUTO_VAR macro
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
|
||||
int WeighedRandom::getTotalWeight(std::vector<WeighedRandomItem*>* items) {
|
||||
int totalWeight = 0;
|
||||
for (AUTO_VAR(it, items->begin()); it != items->end(); it++) {
|
||||
for (auto it = items->begin(); it != items->end(); it++) {
|
||||
totalWeight += (*it)->randomWeight;
|
||||
}
|
||||
return totalWeight;
|
||||
@@ -17,7 +17,7 @@ WeighedRandomItem* WeighedRandom::getRandomItem(
|
||||
|
||||
int selection = random->nextInt(totalWeight);
|
||||
|
||||
for (AUTO_VAR(it, items->begin()); it != items->end(); it++) {
|
||||
for (auto it = items->begin(); it != items->end(); it++) {
|
||||
selection -= (*it)->randomWeight;
|
||||
if (selection < 0) {
|
||||
return *it;
|
||||
|
||||
Reference in New Issue
Block a user