Fixed Errors
This commit is contained in:
parent
3efd232829
commit
56613d2b22
@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
@ -109,6 +109,7 @@ public:
|
||||
static void AddEnchantmentWeightToVector(cWeightedEnchantments * a_Enchantments, int a_Weight, cEnchantments a_Enchantment);
|
||||
/** Remove a enchantment weight from the vector */
|
||||
static void RemoveEnchantmentWeightFromVector(cWeightedEnchantments * a_Enchantments, int a_EnchantmentID);
|
||||
static void RemoveEnchantmentWeightFromVector(cWeightedEnchantments * a_Enchantments, cEnchantments a_Enchantment);
|
||||
|
||||
/** Check enchantment conflicts from enchantments from the vector */
|
||||
static void CheckEnchantmentConflictsFromVector(cWeightedEnchantments & a_Enchantments, cEnchantments a_FirstEnchantment);
|
||||
|
@ -286,7 +286,7 @@ bool cItem::EnchantByXPLevels(int a_NumXPLevels)
|
||||
|
||||
cEnchantments Enchantment1 = cEnchantments::GetRandomEnchantmentFromVector(enchantments);
|
||||
m_Enchantments.AddFromString(Enchantment1.ToString());
|
||||
enchantments.erase(std::remove(enchantments.begin(), enchantments.end(), Enchantment1), enchantments.end());
|
||||
cEnchantments::RemoveEnchantmentWeightFromVector(&enchantments, Enchantment1);
|
||||
|
||||
// Checking for conflicting enchantments
|
||||
cEnchantments::CheckEnchantmentConflictsFromVector(enchantments, Enchantment1);
|
||||
@ -302,7 +302,7 @@ bool cItem::EnchantByXPLevels(int a_NumXPLevels)
|
||||
{
|
||||
cEnchantments Enchantment2 = cEnchantments::GetRandomEnchantmentFromVector(enchantments);
|
||||
m_Enchantments.AddFromString(Enchantment2.ToString());
|
||||
enchantments.erase(std::remove(enchantments.begin(), enchantments.end(), Enchantment2), enchantments.end());
|
||||
cEnchantments::RemoveEnchantmentWeightFromVector(&enchantments, Enchantment2);
|
||||
|
||||
// Checking for conflicting enchantments
|
||||
cEnchantments::CheckEnchantmentConflictsFromVector(enchantments, Enchantment2);
|
||||
@ -318,7 +318,7 @@ bool cItem::EnchantByXPLevels(int a_NumXPLevels)
|
||||
{
|
||||
cEnchantments Enchantment3 = cEnchantments::GetRandomEnchantmentFromVector(enchantments);
|
||||
m_Enchantments.AddFromString(Enchantment3.ToString());
|
||||
enchantments.erase(std::remove(enchantments.begin(), enchantments.end(), Enchantment3), enchantments.end());
|
||||
cEnchantments::RemoveEnchantmentWeightFromVector(&enchantments, Enchantment3);
|
||||
|
||||
// Checking for conflicting enchantments
|
||||
cEnchantments::CheckEnchantmentConflictsFromVector(enchantments, Enchantment3);
|
||||
@ -334,7 +334,6 @@ bool cItem::EnchantByXPLevels(int a_NumXPLevels)
|
||||
{
|
||||
cEnchantments Enchantment4 = cEnchantments::GetRandomEnchantmentFromVector(enchantments);
|
||||
m_Enchantments.AddFromString(Enchantment4.ToString());
|
||||
enchantments.erase(std::remove(enchantments.begin(), enchantments.end(), Enchantment4), enchantments.end());
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user