From 55231bb8d3e1a4e2752ac3d444c4287eb0ca4e8b Mon Sep 17 00:00:00 2001 From: void_17 <61356189+void2012@users.noreply.github.com> Date: Fri, 6 Mar 2026 02:11:18 +0700 Subject: Remove AUTO_VAR macro and _toString function (#592) --- Minecraft.World/WeighedRandom.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'Minecraft.World/WeighedRandom.cpp') diff --git a/Minecraft.World/WeighedRandom.cpp b/Minecraft.World/WeighedRandom.cpp index 8839b0c5..0c27bf32 100644 --- a/Minecraft.World/WeighedRandom.cpp +++ b/Minecraft.World/WeighedRandom.cpp @@ -4,9 +4,9 @@ int WeighedRandom::getTotalWeight(vector *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, vectornextInt(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; -- cgit v1.2.3