diff options
author | daniel0916 <theschokolps@gmail.com> | 2014-04-18 14:34:29 +0200 |
---|---|---|
committer | daniel0916 <theschokolps@gmail.com> | 2014-04-18 14:34:29 +0200 |
commit | 56613d2b22c82f301eb651d1f24a0c2155917d24 (patch) | |
tree | c2b6832da76c7252141554ae0012e42aca6c8ba0 /src/Enchantments.cpp | |
parent | Removed old include (diff) | |
download | cuberite-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.cpp | 20 |
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(); } |