summaryrefslogtreecommitdiffstats
path: root/src/Enchantments.cpp
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2015-08-20 18:18:08 +0200
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2015-08-20 18:18:08 +0200
commita341419b047bd76cc3572f5d3906500a7112e202 (patch)
tree1dd7ee5497546420714dc673f48078a4565198d0 /src/Enchantments.cpp
parentMerge pull request #2379 from cuberite/hunger (diff)
parentUse container-based infrastructure for Travis (diff)
downloadcuberite-a341419b047bd76cc3572f5d3906500a7112e202.tar
cuberite-a341419b047bd76cc3572f5d3906500a7112e202.tar.gz
cuberite-a341419b047bd76cc3572f5d3906500a7112e202.tar.bz2
cuberite-a341419b047bd76cc3572f5d3906500a7112e202.tar.lz
cuberite-a341419b047bd76cc3572f5d3906500a7112e202.tar.xz
cuberite-a341419b047bd76cc3572f5d3906500a7112e202.tar.zst
cuberite-a341419b047bd76cc3572f5d3906500a7112e202.zip
Diffstat (limited to 'src/Enchantments.cpp')
-rw-r--r--src/Enchantments.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/Enchantments.cpp b/src/Enchantments.cpp
index 17c77dd93..34270b2f3 100644
--- a/src/Enchantments.cpp
+++ b/src/Enchantments.cpp
@@ -1040,7 +1040,7 @@ cEnchantments cEnchantments::SelectEnchantmentFromVector(const cWeightedEnchantm
{
// Sum up all the enchantments' weights:
int AllWeights = 0;
- for (const auto Enchantment : a_Enchantments)
+ for (const auto & Enchantment : a_Enchantments)
{
AllWeights += Enchantment.m_Weight;
}
@@ -1054,7 +1054,7 @@ cEnchantments cEnchantments::SelectEnchantmentFromVector(const cWeightedEnchantm
// Pick a random enchantment:
cNoise Noise(a_Seed);
int RandomNumber = Noise.IntNoise1DInt(AllWeights) / 7 % AllWeights;
- for (const auto Enchantment : a_Enchantments)
+ for (const auto & Enchantment : a_Enchantments)
{
RandomNumber -= Enchantment.m_Weight;
if (RandomNumber <= 0)