diff options
author | daniel0916 <theschokolps@gmail.com> | 2014-04-15 20:55:37 +0200 |
---|---|---|
committer | daniel0916 <theschokolps@gmail.com> | 2014-04-15 20:55:37 +0200 |
commit | fb3c755c0a6d1ccaae8e990375229afee4827e0c (patch) | |
tree | 9b54d327615df54361ac7365dff94f02aee43035 | |
parent | Add linux compatibility (diff) | |
download | cuberite-fb3c755c0a6d1ccaae8e990375229afee4827e0c.tar cuberite-fb3c755c0a6d1ccaae8e990375229afee4827e0c.tar.gz cuberite-fb3c755c0a6d1ccaae8e990375229afee4827e0c.tar.bz2 cuberite-fb3c755c0a6d1ccaae8e990375229afee4827e0c.tar.lz cuberite-fb3c755c0a6d1ccaae8e990375229afee4827e0c.tar.xz cuberite-fb3c755c0a6d1ccaae8e990375229afee4827e0c.tar.zst cuberite-fb3c755c0a6d1ccaae8e990375229afee4827e0c.zip |
Diffstat (limited to '')
-rw-r--r-- | src/ClientHandle.cpp | 94 | ||||
-rw-r--r-- | src/ClientHandle.h | 4 |
2 files changed, 49 insertions, 49 deletions
diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp index bcec20973..ee94cd08d 100644 --- a/src/ClientHandle.cpp +++ b/src/ClientHandle.cpp @@ -3165,162 +3165,162 @@ void cClientHandle::HandleEnchantItem(Byte & WindowID, Byte & Enchantment) -cEnchantmentsVector cClientHandle::AddEnchantmentWeight(cEnchantmentsVector a_Map, int a_Weight, cEnchantments a_Enchantment) +cEnchantmentsVector cClientHandle::AddEnchantmentWeight(cEnchantmentsVector a_Enchantments, int a_Weight, cEnchantments a_Enchantment) { for (int i = 0; i < a_Weight; i++) { - a_Map.push_back(a_Enchantment); + a_Enchantments.push_back(a_Enchantment); } - return a_Map; + return a_Enchantments; } -cEnchantmentsVector cClientHandle::CheckEnchantmentConflicts(cEnchantmentsVector a_Map, cEnchantments a_FirstEnchantment) +cEnchantmentsVector cClientHandle::CheckEnchantmentConflicts(cEnchantmentsVector a_Enchantments, cEnchantments a_FirstEnchantment) { int FirstEnchantmentID = atoi(StringSplit(a_FirstEnchantment.ToString(), "=")[0].c_str()); if (FirstEnchantmentID == cEnchantments::enchProtection) { - for (cEnchantmentsVector::iterator it = a_Map.begin(); it != a_Map.end(); ++it) + for (cEnchantmentsVector::iterator it = a_Enchantments.begin(); it != a_Enchantments.end(); ++it) { 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()); + a_Enchantments.erase(std::remove(a_Enchantments.begin(), a_Enchantments.end(), *it), a_Enchantments.end()); break; } } - for (cEnchantmentsVector::iterator it = a_Map.begin(); it != a_Map.end(); ++it) + for (cEnchantmentsVector::iterator it = a_Enchantments.begin(); it != a_Enchantments.end(); ++it) { 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()); + a_Enchantments.erase(std::remove(a_Enchantments.begin(), a_Enchantments.end(), *it), a_Enchantments.end()); break; } } - for (cEnchantmentsVector::iterator it = a_Map.begin(); it != a_Map.end(); ++it) + for (cEnchantmentsVector::iterator it = a_Enchantments.begin(); it != a_Enchantments.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(), *it), a_Map.end()); + a_Enchantments.erase(std::remove(a_Enchantments.begin(), a_Enchantments.end(), *it), a_Enchantments.end()); break; } } - for (cEnchantmentsVector::iterator it = a_Map.begin(); it != a_Map.end(); ++it) + for (cEnchantmentsVector::iterator it = a_Enchantments.begin(); it != a_Enchantments.end(); ++it) { int EnchantmentID = atoi(StringSplit((*it).ToString(), "=")[0].c_str()); if (EnchantmentID == cEnchantments::enchProjectileProtection) { - a_Map.erase(std::remove(a_Map.begin(), a_Map.end(), *it), a_Map.end()); + a_Enchantments.erase(std::remove(a_Enchantments.begin(), a_Enchantments.end(), *it), a_Enchantments.end()); break; } } } else if (FirstEnchantmentID == cEnchantments::enchFireProtection) { - for (cEnchantmentsVector::iterator it = a_Map.begin(); it != a_Map.end(); ++it) + for (cEnchantmentsVector::iterator it = a_Enchantments.begin(); it != a_Enchantments.end(); ++it) { int EnchantmentID = atoi(StringSplit((*it).ToString(), "=")[0].c_str()); if (EnchantmentID == cEnchantments::enchProtection) { - a_Map.erase(std::remove(a_Map.begin(), a_Map.end(), *it), a_Map.end()); + a_Enchantments.erase(std::remove(a_Enchantments.begin(), a_Enchantments.end(), *it), a_Enchantments.end()); break; } } - for (cEnchantmentsVector::iterator it = a_Map.begin(); it != a_Map.end(); ++it) + for (cEnchantmentsVector::iterator it = a_Enchantments.begin(); it != a_Enchantments.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(), *it), a_Map.end()); + a_Enchantments.erase(std::remove(a_Enchantments.begin(), a_Enchantments.end(), *it), a_Enchantments.end()); break; } } - for (cEnchantmentsVector::iterator it = a_Map.begin(); it != a_Map.end(); ++it) + for (cEnchantmentsVector::iterator it = a_Enchantments.begin(); it != a_Enchantments.end(); ++it) { int EnchantmentID = atoi(StringSplit((*it).ToString(), "=")[0].c_str()); if (EnchantmentID == cEnchantments::enchProjectileProtection) { - a_Map.erase(std::remove(a_Map.begin(), a_Map.end(), *it), a_Map.end()); + a_Enchantments.erase(std::remove(a_Enchantments.begin(), a_Enchantments.end(), *it), a_Enchantments.end()); break; } } } else if (FirstEnchantmentID == cEnchantments::enchBlastProtection) { - for (cEnchantmentsVector::iterator it = a_Map.begin(); it != a_Map.end(); ++it) + for (cEnchantmentsVector::iterator it = a_Enchantments.begin(); it != a_Enchantments.end(); ++it) { int EnchantmentID = atoi(StringSplit((*it).ToString(), "=")[0].c_str()); if (EnchantmentID == cEnchantments::enchProtection) { - a_Map.erase(std::remove(a_Map.begin(), a_Map.end(), *it), a_Map.end()); + a_Enchantments.erase(std::remove(a_Enchantments.begin(), a_Enchantments.end(), *it), a_Enchantments.end()); break; } } - for (cEnchantmentsVector::iterator it = a_Map.begin(); it != a_Map.end(); ++it) + for (cEnchantmentsVector::iterator it = a_Enchantments.begin(); it != a_Enchantments.end(); ++it) { 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()); + a_Enchantments.erase(std::remove(a_Enchantments.begin(), a_Enchantments.end(), *it), a_Enchantments.end()); break; } } - for (cEnchantmentsVector::iterator it = a_Map.begin(); it != a_Map.end(); ++it) + for (cEnchantmentsVector::iterator it = a_Enchantments.begin(); it != a_Enchantments.end(); ++it) { int EnchantmentID = atoi(StringSplit((*it).ToString(), "=")[0].c_str()); if (EnchantmentID == cEnchantments::enchProjectileProtection) { - a_Map.erase(std::remove(a_Map.begin(), a_Map.end(), *it), a_Map.end()); + a_Enchantments.erase(std::remove(a_Enchantments.begin(), a_Enchantments.end(), *it), a_Enchantments.end()); break; } } } else if (FirstEnchantmentID == cEnchantments::enchProjectileProtection) { - for (cEnchantmentsVector::iterator it = a_Map.begin(); it != a_Map.end(); ++it) + for (cEnchantmentsVector::iterator it = a_Enchantments.begin(); it != a_Enchantments.end(); ++it) { int EnchantmentID = atoi(StringSplit((*it).ToString(), "=")[0].c_str()); if (EnchantmentID == cEnchantments::enchProtection) { - a_Map.erase(std::remove(a_Map.begin(), a_Map.end(), *it), a_Map.end()); + a_Enchantments.erase(std::remove(a_Enchantments.begin(), a_Enchantments.end(), *it), a_Enchantments.end()); break; } } - for (cEnchantmentsVector::iterator it = a_Map.begin(); it != a_Map.end(); ++it) + for (cEnchantmentsVector::iterator it = a_Enchantments.begin(); it != a_Enchantments.end(); ++it) { 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()); + a_Enchantments.erase(std::remove(a_Enchantments.begin(), a_Enchantments.end(), *it), a_Enchantments.end()); break; } } - for (cEnchantmentsVector::iterator it = a_Map.begin(); it != a_Map.end(); ++it) + for (cEnchantmentsVector::iterator it = a_Enchantments.begin(); it != a_Enchantments.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(), *it), a_Map.end()); + a_Enchantments.erase(std::remove(a_Enchantments.begin(), a_Enchantments.end(), *it), a_Enchantments.end()); break; } } @@ -3328,101 +3328,101 @@ cEnchantmentsVector cClientHandle::CheckEnchantmentConflicts(cEnchantmentsVector else if (FirstEnchantmentID == cEnchantments::enchSharpness) { - for (cEnchantmentsVector::iterator it = a_Map.begin(); it != a_Map.end(); ++it) + for (cEnchantmentsVector::iterator it = a_Enchantments.begin(); it != a_Enchantments.end(); ++it) { int EnchantmentID = atoi(StringSplit((*it).ToString(), "=")[0].c_str()); if (EnchantmentID == cEnchantments::enchSmite) { - a_Map.erase(std::remove(a_Map.begin(), a_Map.end(), *it), a_Map.end()); + a_Enchantments.erase(std::remove(a_Enchantments.begin(), a_Enchantments.end(), *it), a_Enchantments.end()); break; } } - for (cEnchantmentsVector::iterator it = a_Map.begin(); it != a_Map.end(); ++it) + for (cEnchantmentsVector::iterator it = a_Enchantments.begin(); it != a_Enchantments.end(); ++it) { int EnchantmentID = atoi(StringSplit((*it).ToString(), "=")[0].c_str()); if (EnchantmentID == cEnchantments::enchBaneOfArthropods) { - a_Map.erase(std::remove(a_Map.begin(), a_Map.end(), *it), a_Map.end()); + a_Enchantments.erase(std::remove(a_Enchantments.begin(), a_Enchantments.end(), *it), a_Enchantments.end()); break; } } } else if (FirstEnchantmentID == cEnchantments::enchSmite) { - for (cEnchantmentsVector::iterator it = a_Map.begin(); it != a_Map.end(); ++it) + for (cEnchantmentsVector::iterator it = a_Enchantments.begin(); it != a_Enchantments.end(); ++it) { int EnchantmentID = atoi(StringSplit((*it).ToString(), "=")[0].c_str()); if (EnchantmentID == cEnchantments::enchSharpness) { - a_Map.erase(std::remove(a_Map.begin(), a_Map.end(), *it), a_Map.end()); + a_Enchantments.erase(std::remove(a_Enchantments.begin(), a_Enchantments.end(), *it), a_Enchantments.end()); break; } } - for (cEnchantmentsVector::iterator it = a_Map.begin(); it != a_Map.end(); ++it) + for (cEnchantmentsVector::iterator it = a_Enchantments.begin(); it != a_Enchantments.end(); ++it) { int EnchantmentID = atoi(StringSplit((*it).ToString(), "=")[0].c_str()); if (EnchantmentID == cEnchantments::enchBaneOfArthropods) { - a_Map.erase(std::remove(a_Map.begin(), a_Map.end(), *it), a_Map.end()); + a_Enchantments.erase(std::remove(a_Enchantments.begin(), a_Enchantments.end(), *it), a_Enchantments.end()); break; } } } else if (FirstEnchantmentID == cEnchantments::enchBaneOfArthropods) { - for (cEnchantmentsVector::iterator it = a_Map.begin(); it != a_Map.end(); ++it) + for (cEnchantmentsVector::iterator it = a_Enchantments.begin(); it != a_Enchantments.end(); ++it) { int EnchantmentID = atoi(StringSplit((*it).ToString(), "=")[0].c_str()); if (EnchantmentID == cEnchantments::enchSharpness) { - a_Map.erase(std::remove(a_Map.begin(), a_Map.end(), *it), a_Map.end()); + a_Enchantments.erase(std::remove(a_Enchantments.begin(), a_Enchantments.end(), *it), a_Enchantments.end()); break; } } - for (cEnchantmentsVector::iterator it = a_Map.begin(); it != a_Map.end(); ++it) + for (cEnchantmentsVector::iterator it = a_Enchantments.begin(); it != a_Enchantments.end(); ++it) { int EnchantmentID = atoi(StringSplit((*it).ToString(), "=")[0].c_str()); if (EnchantmentID == cEnchantments::enchSmite) { - a_Map.erase(std::remove(a_Map.begin(), a_Map.end(), *it), a_Map.end()); + a_Enchantments.erase(std::remove(a_Enchantments.begin(), a_Enchantments.end(), *it), a_Enchantments.end()); break; } } } else if (FirstEnchantmentID == cEnchantments::enchSilkTouch) { - for (cEnchantmentsVector::iterator it = a_Map.begin(); it != a_Map.end(); ++it) + for (cEnchantmentsVector::iterator it = a_Enchantments.begin(); it != a_Enchantments.end(); ++it) { int EnchantmentID = atoi(StringSplit((*it).ToString(), "=")[0].c_str()); if (EnchantmentID == cEnchantments::enchFortune) { - a_Map.erase(std::remove(a_Map.begin(), a_Map.end(), *it), a_Map.end()); + a_Enchantments.erase(std::remove(a_Enchantments.begin(), a_Enchantments.end(), *it), a_Enchantments.end()); break; } } } else if (FirstEnchantmentID == cEnchantments::enchFortune) { - for (cEnchantmentsVector::iterator it = a_Map.begin(); it != a_Map.end(); ++it) + for (cEnchantmentsVector::iterator it = a_Enchantments.begin(); it != a_Enchantments.end(); ++it) { int EnchantmentID = atoi(StringSplit((*it).ToString(), "=")[0].c_str()); if (EnchantmentID == cEnchantments::enchSilkTouch) { - a_Map.erase(std::remove(a_Map.begin(), a_Map.end(), *it), a_Map.end()); + a_Enchantments.erase(std::remove(a_Enchantments.begin(), a_Enchantments.end(), *it), a_Enchantments.end()); break; } } } - return a_Map; + return a_Enchantments; } diff --git a/src/ClientHandle.h b/src/ClientHandle.h index b4b1d0da3..b9e470653 100644 --- a/src/ClientHandle.h +++ b/src/ClientHandle.h @@ -234,8 +234,8 @@ public: /** Called when the player will enchant a Item */ void HandleEnchantItem(Byte & WindowID, Byte & Enchantment); - cEnchantmentsVector AddEnchantmentWeight(cEnchantmentsVector a_Map, int a_Weight, cEnchantments a_Enchantment); - cEnchantmentsVector CheckEnchantmentConflicts(cEnchantmentsVector a_Map, cEnchantments a_FirstEnchantment); + cEnchantmentsVector AddEnchantmentWeight(cEnchantmentsVector a_Enchantments, int a_Weight, cEnchantments a_Enchantment); + cEnchantmentsVector CheckEnchantmentConflicts(cEnchantmentsVector a_Enchantments, cEnchantments a_FirstEnchantment); private: |