summaryrefslogtreecommitdiffstats
path: root/src/Enchantments.cpp
diff options
context:
space:
mode:
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();
}