summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHowaner <franzi.moos@googlemail.com>2014-04-14 23:10:13 +0200
committerdaniel0916 <theschokolps@gmail.com>2014-04-15 20:42:39 +0200
commit8df922e3e0f94dca067926db3cb1229956df96db (patch)
tree7aea3ead2f2a64e69f8fff99c7e0082cc8acd0f3 /src
parentAdded ItemPlaceCount in SlotArea (diff)
downloadcuberite-8df922e3e0f94dca067926db3cb1229956df96db.tar
cuberite-8df922e3e0f94dca067926db3cb1229956df96db.tar.gz
cuberite-8df922e3e0f94dca067926db3cb1229956df96db.tar.bz2
cuberite-8df922e3e0f94dca067926db3cb1229956df96db.tar.lz
cuberite-8df922e3e0f94dca067926db3cb1229956df96db.tar.xz
cuberite-8df922e3e0f94dca067926db3cb1229956df96db.tar.zst
cuberite-8df922e3e0f94dca067926db3cb1229956df96db.zip
Diffstat (limited to '')
-rw-r--r--src/ClientHandle.cpp132
1 files changed, 71 insertions, 61 deletions
diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp
index 9605aa004..bcec20973 100644
--- a/src/ClientHandle.cpp
+++ b/src/ClientHandle.cpp
@@ -3181,136 +3181,146 @@ cEnchantmentsVector cClientHandle::AddEnchantmentWeight(cEnchantmentsVector a_Ma
cEnchantmentsVector cClientHandle::CheckEnchantmentConflicts(cEnchantmentsVector a_Map, cEnchantments a_FirstEnchantment)
{
- int FirstEnchantmentID = std::stoi(StringSplit(a_FirstEnchantment.ToString(), "=")[0]);
+ int FirstEnchantmentID = atoi(StringSplit(a_FirstEnchantment.ToString(), "=")[0].c_str());
if (FirstEnchantmentID == cEnchantments::enchProtection)
{
- for (cEnchantments enchantment : a_Map)
+ for (cEnchantmentsVector::iterator it = a_Map.begin(); it != a_Map.end(); ++it)
{
- int EnchantmentID = std::stoi(StringSplit(enchantment.ToString(), "=")[0]);
+ int EnchantmentID = atoi(StringSplit((*it).ToString(), "=")[0].c_str());
if (EnchantmentID == cEnchantments::enchFireProtection)
{
- a_Map.erase(std::remove(a_Map.begin(), a_Map.end(), enchantment), a_Map.end());
+ a_Map.erase(std::remove(a_Map.begin(), a_Map.end(), *it), a_Map.end());
break;
}
}
- for (cEnchantments enchantment : a_Map)
+ for (cEnchantmentsVector::iterator it = a_Map.begin(); it != a_Map.end(); ++it)
{
- int EnchantmentID = std::stoi(StringSplit(enchantment.ToString(), "=")[0]);
+ int EnchantmentID = atoi(StringSplit((*it).ToString(), "=")[0].c_str());
+
+ if (EnchantmentID == cEnchantments::enchFireProtection)
+ {
+ a_Map.erase(std::remove(a_Map.begin(), a_Map.end(), *it), a_Map.end());
+ break;
+ }
+ }
+ for (cEnchantmentsVector::iterator it = a_Map.begin(); it != a_Map.end(); ++it)
+ {
+ int EnchantmentID = atoi(StringSplit((*it).ToString(), "=")[0].c_str());
if (EnchantmentID == cEnchantments::enchBlastProtection)
{
- a_Map.erase(std::remove(a_Map.begin(), a_Map.end(), enchantment), a_Map.end());
+ a_Map.erase(std::remove(a_Map.begin(), a_Map.end(), *it), a_Map.end());
break;
}
}
- for (cEnchantments enchantment : a_Map)
+ for (cEnchantmentsVector::iterator it = a_Map.begin(); it != a_Map.end(); ++it)
{
- int EnchantmentID = std::stoi(StringSplit(enchantment.ToString(), "=")[0]);
+ int EnchantmentID = atoi(StringSplit((*it).ToString(), "=")[0].c_str());
if (EnchantmentID == cEnchantments::enchProjectileProtection)
{
- a_Map.erase(std::remove(a_Map.begin(), a_Map.end(), enchantment), a_Map.end());
+ a_Map.erase(std::remove(a_Map.begin(), a_Map.end(), *it), a_Map.end());
break;
}
}
}
else if (FirstEnchantmentID == cEnchantments::enchFireProtection)
{
- for (cEnchantments enchantment : a_Map)
+ for (cEnchantmentsVector::iterator it = a_Map.begin(); it != a_Map.end(); ++it)
{
- int EnchantmentID = std::stoi(StringSplit(enchantment.ToString(), "=")[0]);
+ int EnchantmentID = atoi(StringSplit((*it).ToString(), "=")[0].c_str());
if (EnchantmentID == cEnchantments::enchProtection)
{
- a_Map.erase(std::remove(a_Map.begin(), a_Map.end(), enchantment), a_Map.end());
+ a_Map.erase(std::remove(a_Map.begin(), a_Map.end(), *it), a_Map.end());
break;
}
}
- for (cEnchantments enchantment : a_Map)
+ for (cEnchantmentsVector::iterator it = a_Map.begin(); it != a_Map.end(); ++it)
{
- int EnchantmentID = std::stoi(StringSplit(enchantment.ToString(), "=")[0]);
+ int EnchantmentID = atoi(StringSplit((*it).ToString(), "=")[0].c_str());
if (EnchantmentID == cEnchantments::enchBlastProtection)
{
- a_Map.erase(std::remove(a_Map.begin(), a_Map.end(), enchantment), a_Map.end());
+ a_Map.erase(std::remove(a_Map.begin(), a_Map.end(), *it), a_Map.end());
break;
}
}
- for (cEnchantments enchantment : a_Map)
+ for (cEnchantmentsVector::iterator it = a_Map.begin(); it != a_Map.end(); ++it)
{
- int EnchantmentID = std::stoi(StringSplit(enchantment.ToString(), "=")[0]);
+ int EnchantmentID = atoi(StringSplit((*it).ToString(), "=")[0].c_str());
if (EnchantmentID == cEnchantments::enchProjectileProtection)
{
- a_Map.erase(std::remove(a_Map.begin(), a_Map.end(), enchantment), a_Map.end());
+ a_Map.erase(std::remove(a_Map.begin(), a_Map.end(), *it), a_Map.end());
break;
}
}
}
else if (FirstEnchantmentID == cEnchantments::enchBlastProtection)
{
- for (cEnchantments enchantment : a_Map)
+ for (cEnchantmentsVector::iterator it = a_Map.begin(); it != a_Map.end(); ++it)
{
- int EnchantmentID = std::stoi(StringSplit(enchantment.ToString(), "=")[0]);
+ int EnchantmentID = atoi(StringSplit((*it).ToString(), "=")[0].c_str());
if (EnchantmentID == cEnchantments::enchProtection)
{
- a_Map.erase(std::remove(a_Map.begin(), a_Map.end(), enchantment), a_Map.end());
+ a_Map.erase(std::remove(a_Map.begin(), a_Map.end(), *it), a_Map.end());
break;
}
}
- for (cEnchantments enchantment : a_Map)
+ for (cEnchantmentsVector::iterator it = a_Map.begin(); it != a_Map.end(); ++it)
{
- int EnchantmentID = std::stoi(StringSplit(enchantment.ToString(), "=")[0]);
+ int EnchantmentID = atoi(StringSplit((*it).ToString(), "=")[0].c_str());
if (EnchantmentID == cEnchantments::enchFireProtection)
{
- a_Map.erase(std::remove(a_Map.begin(), a_Map.end(), enchantment), a_Map.end());
+ a_Map.erase(std::remove(a_Map.begin(), a_Map.end(), *it), a_Map.end());
break;
}
}
- for (cEnchantments enchantment : a_Map)
+ for (cEnchantmentsVector::iterator it = a_Map.begin(); it != a_Map.end(); ++it)
{
- int EnchantmentID = std::stoi(StringSplit(enchantment.ToString(), "=")[0]);
+ int EnchantmentID = atoi(StringSplit((*it).ToString(), "=")[0].c_str());
if (EnchantmentID == cEnchantments::enchProjectileProtection)
{
- a_Map.erase(std::remove(a_Map.begin(), a_Map.end(), enchantment), a_Map.end());
+ a_Map.erase(std::remove(a_Map.begin(), a_Map.end(), *it), a_Map.end());
break;
}
}
}
else if (FirstEnchantmentID == cEnchantments::enchProjectileProtection)
{
- for (cEnchantments enchantment : a_Map)
+ for (cEnchantmentsVector::iterator it = a_Map.begin(); it != a_Map.end(); ++it)
{
- int EnchantmentID = std::stoi(StringSplit(enchantment.ToString(), "=")[0]);
+ int EnchantmentID = atoi(StringSplit((*it).ToString(), "=")[0].c_str());
if (EnchantmentID == cEnchantments::enchProtection)
{
- a_Map.erase(std::remove(a_Map.begin(), a_Map.end(), enchantment), a_Map.end());
+ a_Map.erase(std::remove(a_Map.begin(), a_Map.end(), *it), a_Map.end());
break;
}
}
- for (cEnchantments enchantment : a_Map)
+ for (cEnchantmentsVector::iterator it = a_Map.begin(); it != a_Map.end(); ++it)
{
- int EnchantmentID = std::stoi(StringSplit(enchantment.ToString(), "=")[0]);
+ int EnchantmentID = atoi(StringSplit((*it).ToString(), "=")[0].c_str());
if (EnchantmentID == cEnchantments::enchFireProtection)
{
- a_Map.erase(std::remove(a_Map.begin(), a_Map.end(), enchantment), a_Map.end());
+ a_Map.erase(std::remove(a_Map.begin(), a_Map.end(), *it), a_Map.end());
break;
}
}
- for (cEnchantments enchantment : a_Map)
+ for (cEnchantmentsVector::iterator it = a_Map.begin(); it != a_Map.end(); ++it)
{
- int EnchantmentID = std::stoi(StringSplit(enchantment.ToString(), "=")[0]);
+ int EnchantmentID = atoi(StringSplit((*it).ToString(), "=")[0].c_str());
if (EnchantmentID == cEnchantments::enchBlastProtection)
{
- a_Map.erase(std::remove(a_Map.begin(), a_Map.end(), enchantment), a_Map.end());
+ a_Map.erase(std::remove(a_Map.begin(), a_Map.end(), *it), a_Map.end());
break;
}
}
@@ -3318,95 +3328,95 @@ cEnchantmentsVector cClientHandle::CheckEnchantmentConflicts(cEnchantmentsVector
else if (FirstEnchantmentID == cEnchantments::enchSharpness)
{
- for (cEnchantments enchantment : a_Map)
+ for (cEnchantmentsVector::iterator it = a_Map.begin(); it != a_Map.end(); ++it)
{
- int EnchantmentID = std::stoi(StringSplit(enchantment.ToString(), "=")[0]);
+ int EnchantmentID = atoi(StringSplit((*it).ToString(), "=")[0].c_str());
if (EnchantmentID == cEnchantments::enchSmite)
{
- a_Map.erase(std::remove(a_Map.begin(), a_Map.end(), enchantment), a_Map.end());
+ a_Map.erase(std::remove(a_Map.begin(), a_Map.end(), *it), a_Map.end());
break;
}
}
- for (cEnchantments enchantment : a_Map)
+ for (cEnchantmentsVector::iterator it = a_Map.begin(); it != a_Map.end(); ++it)
{
- int EnchantmentID = std::stoi(StringSplit(enchantment.ToString(), "=")[0]);
+ int EnchantmentID = atoi(StringSplit((*it).ToString(), "=")[0].c_str());
if (EnchantmentID == cEnchantments::enchBaneOfArthropods)
{
- a_Map.erase(std::remove(a_Map.begin(), a_Map.end(), enchantment), a_Map.end());
+ a_Map.erase(std::remove(a_Map.begin(), a_Map.end(), *it), a_Map.end());
break;
}
}
}
else if (FirstEnchantmentID == cEnchantments::enchSmite)
{
- for (cEnchantments enchantment : a_Map)
+ for (cEnchantmentsVector::iterator it = a_Map.begin(); it != a_Map.end(); ++it)
{
- int EnchantmentID = std::stoi(StringSplit(enchantment.ToString(), "=")[0]);
+ int EnchantmentID = atoi(StringSplit((*it).ToString(), "=")[0].c_str());
if (EnchantmentID == cEnchantments::enchSharpness)
{
- a_Map.erase(std::remove(a_Map.begin(), a_Map.end(), enchantment), a_Map.end());
+ a_Map.erase(std::remove(a_Map.begin(), a_Map.end(), *it), a_Map.end());
break;
}
}
- for (cEnchantments enchantment : a_Map)
+ for (cEnchantmentsVector::iterator it = a_Map.begin(); it != a_Map.end(); ++it)
{
- int EnchantmentID = std::stoi(StringSplit(enchantment.ToString(), "=")[0]);
+ int EnchantmentID = atoi(StringSplit((*it).ToString(), "=")[0].c_str());
if (EnchantmentID == cEnchantments::enchBaneOfArthropods)
{
- a_Map.erase(std::remove(a_Map.begin(), a_Map.end(), enchantment), a_Map.end());
+ a_Map.erase(std::remove(a_Map.begin(), a_Map.end(), *it), a_Map.end());
break;
}
}
}
else if (FirstEnchantmentID == cEnchantments::enchBaneOfArthropods)
{
- for (cEnchantments enchantment : a_Map)
+ for (cEnchantmentsVector::iterator it = a_Map.begin(); it != a_Map.end(); ++it)
{
- int EnchantmentID = std::stoi(StringSplit(enchantment.ToString(), "=")[0]);
+ int EnchantmentID = atoi(StringSplit((*it).ToString(), "=")[0].c_str());
if (EnchantmentID == cEnchantments::enchSharpness)
{
- a_Map.erase(std::remove(a_Map.begin(), a_Map.end(), enchantment), a_Map.end());
+ a_Map.erase(std::remove(a_Map.begin(), a_Map.end(), *it), a_Map.end());
break;
}
}
- for (cEnchantments enchantment : a_Map)
+ for (cEnchantmentsVector::iterator it = a_Map.begin(); it != a_Map.end(); ++it)
{
- int EnchantmentID = std::stoi(StringSplit(enchantment.ToString(), "=")[0]);
+ int EnchantmentID = atoi(StringSplit((*it).ToString(), "=")[0].c_str());
if (EnchantmentID == cEnchantments::enchSmite)
{
- a_Map.erase(std::remove(a_Map.begin(), a_Map.end(), enchantment), a_Map.end());
+ a_Map.erase(std::remove(a_Map.begin(), a_Map.end(), *it), a_Map.end());
break;
}
}
}
else if (FirstEnchantmentID == cEnchantments::enchSilkTouch)
{
- for (cEnchantments enchantment : a_Map)
+ for (cEnchantmentsVector::iterator it = a_Map.begin(); it != a_Map.end(); ++it)
{
- int EnchantmentID = std::stoi(StringSplit(enchantment.ToString(), "=")[0]);
+ int EnchantmentID = atoi(StringSplit((*it).ToString(), "=")[0].c_str());
if (EnchantmentID == cEnchantments::enchFortune)
{
- a_Map.erase(std::remove(a_Map.begin(), a_Map.end(), enchantment), a_Map.end());
+ a_Map.erase(std::remove(a_Map.begin(), a_Map.end(), *it), a_Map.end());
break;
}
}
}
else if (FirstEnchantmentID == cEnchantments::enchFortune)
{
- for (cEnchantments enchantment : a_Map)
+ for (cEnchantmentsVector::iterator it = a_Map.begin(); it != a_Map.end(); ++it)
{
- int EnchantmentID = std::stoi(StringSplit(enchantment.ToString(), "=")[0]);
+ int EnchantmentID = atoi(StringSplit((*it).ToString(), "=")[0].c_str());
if (EnchantmentID == cEnchantments::enchSilkTouch)
{
- a_Map.erase(std::remove(a_Map.begin(), a_Map.end(), enchantment), a_Map.end());
+ a_Map.erase(std::remove(a_Map.begin(), a_Map.end(), *it), a_Map.end());
break;
}
}