summaryrefslogtreecommitdiffstats
path: root/src/Enchantments.cpp
diff options
context:
space:
mode:
authordaniel0916 <theschokolps@gmail.com>2014-04-18 14:34:29 +0200
committerdaniel0916 <theschokolps@gmail.com>2014-04-18 14:34:29 +0200
commit56613d2b22c82f301eb651d1f24a0c2155917d24 (patch)
treec2b6832da76c7252141554ae0012e42aca6c8ba0 /src/Enchantments.cpp
parentRemoved old include (diff)
downloadcuberite-56613d2b22c82f301eb651d1f24a0c2155917d24.tar
cuberite-56613d2b22c82f301eb651d1f24a0c2155917d24.tar.gz
cuberite-56613d2b22c82f301eb651d1f24a0c2155917d24.tar.bz2
cuberite-56613d2b22c82f301eb651d1f24a0c2155917d24.tar.lz
cuberite-56613d2b22c82f301eb651d1f24a0c2155917d24.tar.xz
cuberite-56613d2b22c82f301eb651d1f24a0c2155917d24.tar.zst
cuberite-56613d2b22c82f301eb651d1f24a0c2155917d24.zip
Diffstat (limited to '')
-rw-r--r--src/Enchantments.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/Enchantments.cpp b/src/Enchantments.cpp
index 3caebdff5..ca72065ff 100644
--- a/src/Enchantments.cpp
+++ b/src/Enchantments.cpp
@@ -893,7 +893,23 @@ void cEnchantments::RemoveEnchantmentWeightFromVector(cWeightedEnchantments * a_
if (EnchantmentID == a_EnchantmentID)
{
- a_Enchantments->erase(std::remove(a_Enchantments->begin(), a_Enchantments->end(), *it), a_Enchantments->end());
+ a_Enchantments->erase(it);
+ break;
+ }
+ }
+}
+
+
+
+
+
+void cEnchantments::RemoveEnchantmentWeightFromVector(cWeightedEnchantments * a_Enchantments, cEnchantments a_Enchantment)
+{
+ for (cWeightedEnchantments::iterator it = a_Enchantments->begin(); it != a_Enchantments->end(); ++it)
+ {
+ if ((*it).m_Enchantments == a_Enchantment)
+ {
+ a_Enchantments->erase(it);
break;
}
}
@@ -980,6 +996,8 @@ cEnchantments cEnchantments::GetRandomEnchantmentFromVector(cWeightedEnchantment
return (*it).m_Enchantments;
}
}
+
+ return cEnchantments();
}