summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/Enchantments.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/Enchantments.cpp b/src/Enchantments.cpp
index 10d23a8fb..80a9810b6 100644
--- a/src/Enchantments.cpp
+++ b/src/Enchantments.cpp
@@ -1024,20 +1024,20 @@ cEnchantments cEnchantments::GetRandomEnchantmentFromVector(cWeightedEnchantment
cEnchantments cEnchantments::GenerateEnchantmentFromVector(cWeightedEnchantments & a_Enchantments, int a_Seed)
{
int AllWeights = 0;
- for (cWeightedEnchantments::iterator it = a_Enchantments.begin(); it != a_Enchantments.end(); ++it)
+ for (const auto Enchantment : a_Enchantments)
{
- AllWeights += (*it).m_Weight;
+ AllWeights += Enchantment.m_Weight;
}
cNoise Noise(a_Seed);
int RandomNumber = Noise.IntNoise1DInt(AllWeights) / 7 % AllWeights;
- for (cWeightedEnchantments::iterator it = a_Enchantments.begin(); it != a_Enchantments.end(); ++it)
+ for (const auto Enchantment : a_Enchantments)
{
- RandomNumber -= (*it).m_Weight;
+ RandomNumber -= Enchantment.m_Weight;
if (RandomNumber < 0)
{
- return (*it).m_Enchantments;
+ return Enchantment.m_Enchantments;
}
}