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/PotionBrewing.cpp | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) (limited to 'Minecraft.World/PotionBrewing.cpp') diff --git a/Minecraft.World/PotionBrewing.cpp b/Minecraft.World/PotionBrewing.cpp index 5c454fd4..8e27a601 100644 --- a/Minecraft.World/PotionBrewing.cpp +++ b/Minecraft.World/PotionBrewing.cpp @@ -197,9 +197,8 @@ int PotionBrewing::getColorValue(vector *effects) float count = 0; //for (MobEffectInstance effect : effects){ - for(AUTO_VAR(it, effects->begin()); it != effects->end(); ++it) + for(auto& effect : *effects) { - MobEffectInstance *effect = *it; int potionColor = colourTable->getColor( MobEffect::effects[effect->getId()]->getColor() ); for (int potency = 0; potency <= effect->getAmplifier(); potency++) @@ -220,9 +219,8 @@ int PotionBrewing::getColorValue(vector *effects) bool PotionBrewing::areAllEffectsAmbient(vector *effects) { - for(AUTO_VAR(it, effects->begin()); it != effects->end(); ++it) + for(auto& effect : *effects) { - MobEffectInstance *effect = *it; if (!effect->isAmbient()) return false; } @@ -233,8 +231,8 @@ int PotionBrewing::getColorValue(int brew, bool includeDisabledEffects) { if (!includeDisabledEffects) { - AUTO_VAR(colIt, cachedColors.find(brew)); - if (colIt != cachedColors.end()) + auto colIt = cachedColors.find(brew); + if (colIt != cachedColors.end()) { return colIt->second;//cachedColors.get(brew); } @@ -242,9 +240,8 @@ int PotionBrewing::getColorValue(int brew, bool includeDisabledEffects) int color = getColorValue(effects); if(effects != NULL) { - for(AUTO_VAR(it, effects->begin()); it != effects->end(); ++it) + for(auto& effect : *effects) { - MobEffectInstance *effect = *it; delete effect; } delete effects; @@ -566,8 +563,8 @@ vector *PotionBrewing::getEffects(int brew, bool includeDis continue; } //wstring durationString = potionEffectDuration.get(effect->getId()); - AUTO_VAR(effIt, potionEffectDuration.find(effect->getId())); - if ( effIt == potionEffectDuration.end() ) + auto effIt = potionEffectDuration.find(effect->getId()); + if ( effIt == potionEffectDuration.end() ) { continue; } @@ -577,9 +574,9 @@ vector *PotionBrewing::getEffects(int brew, bool includeDis if (duration > 0) { int amplifier = 0; - AUTO_VAR(ampIt, potionEffectAmplifier.find(effect->getId())); - if (ampIt != potionEffectAmplifier.end()) - { + auto ampIt = potionEffectAmplifier.find(effect->getId()); + if (ampIt != potionEffectAmplifier.end()) + { wstring amplifierString = ampIt->second; amplifier = parseEffectFormulaValue(amplifierString, 0, (int)amplifierString.length(), brew); if (amplifier < 0) -- cgit v1.2.3