aboutsummaryrefslogtreecommitdiff
path: root/src/game/Player.cpp
diff options
context:
space:
mode:
authormaximius <none@none>2009-11-21 06:13:20 -0800
committermaximius <none@none>2009-11-21 06:13:20 -0800
commite73ab432eb386dedb1e22b56d124c9ef7da46da6 (patch)
tree9ce5e09a975e48da7e5636a2df7915c31b7f6568 /src/game/Player.cpp
parent51a2284f693060ff8b0b53256a1f0f71735448dd (diff)
*Fix a stupid mistake on my part that caused the removal loop to never start, and -aggressively- remove talent/spells on talent reset & spec swap.
--HG-- branch : trunk
Diffstat (limited to 'src/game/Player.cpp')
-rw-r--r--src/game/Player.cpp31
1 files changed, 19 insertions, 12 deletions
diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index f6b8a3fb3db..f0a16279b7b 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -3475,7 +3475,7 @@ void Player::removeSpell(uint32 spell_id, bool disabled, bool learn_low_rank)
uint32 skill_value = GetPureSkillValue(prevSkill->skill);
uint32 skill_max_value = GetPureMaxSkillValue(prevSkill->skill);
- if (skill_value > prevSkill->value)
+ if (skill_value > prevSkill->value)
skill_value = prevSkill->value;
uint32 new_skill_max_value = prevSkill->maxvalue == 0 ? GetMaxSkillValueForLevel() : prevSkill->maxvalue;
@@ -3791,10 +3791,10 @@ bool Player::resetTalents(bool no_cost)
}
*/
- PlayerTalentMap::iterator plrTalent = m_talents[m_activeSpec]->find(talentInfo->TalentID);
- if (plrTalent != m_talents[m_activeSpec]->end() || m_talents[m_activeSpec]->empty())
+ for (int8 rank = MAX_TALENT_RANK-1; rank >= 0; --rank)
{
- for (int8 rank = MAX_TALENT_RANK-1; rank >= 0; --rank)
+ PlayerTalentMap::iterator plrTalent = m_talents[m_activeSpec]->find(talentInfo->RankID[rank]);
+ if (plrTalent != m_talents[m_activeSpec]->end() || m_talents[m_activeSpec]->empty())
{
for (PlayerSpellMap::iterator itr = GetSpellMap().begin(); itr != GetSpellMap().end();)
{
@@ -3804,15 +3804,19 @@ bool Player::resetTalents(bool no_cost)
// unlearn if first rank is talent or learned by talent
if (itrFirstId == talentInfo->RankID[rank])
{
- itr->second->disabled = false;
+ itr->second->state = PLAYERSPELL_NEW;
removeSpell(itr->first, false, false);
+ itr->second->disabled = true;
+ itr->second->state = PLAYERSPELL_REMOVED;
itr = GetSpellMap().begin();
continue;
}
else if (spellmgr.IsSpellLearnToSpell(talentInfo->RankID[rank], itrFirstId))
{
- itr->second->disabled = false;
+ itr->second->state = PLAYERSPELL_NEW;
removeSpell(itr->first, false, true);
+ itr->second->disabled = true;
+ itr->second->state = PLAYERSPELL_REMOVED;
itr = GetSpellMap().begin();
continue;
}
@@ -22014,10 +22018,10 @@ void Player::ActivateSpec(uint8 spec)
if (talentInfo->TalentTab != talentTabId)
continue;
- PlayerTalentMap::iterator plrTalent = m_talents[m_activeSpec]->find(talentInfo->TalentID);
- if (plrTalent != m_talents[m_activeSpec]->end())
+ for (int8 rank = MAX_TALENT_RANK-1; rank >= 0; --rank)
{
- for (int8 rank = MAX_TALENT_RANK-1; rank >= 0; --rank)
+ PlayerTalentMap::iterator plrTalent = m_talents[m_activeSpec]->find(talentInfo->RankID[rank]);
+ if (plrTalent != m_talents[m_activeSpec]->end() || m_talents[m_activeSpec]->empty())
{
for (PlayerSpellMap::iterator itr = GetSpellMap().begin(); itr != GetSpellMap().end();)
{
@@ -22027,15 +22031,18 @@ void Player::ActivateSpec(uint8 spec)
// unlearn if first rank is talent or learned by talent
if (itrFirstId == talentInfo->RankID[rank])
{
- itr->second->disabled = false;
+ itr->second->state = PLAYERSPELL_NEW;
removeSpell(itr->first, false, false);
- itr = GetSpellMap().begin();
+ itr->second->disabled = true;
+ itr->second->state = PLAYERSPELL_REMOVED;
continue;
}
else if (spellmgr.IsSpellLearnToSpell(talentInfo->RankID[rank], itrFirstId))
{
- itr->second->disabled = false;
+ itr->second->state = PLAYERSPELL_NEW;
removeSpell(itr->first, false, true);
+ itr->second->disabled = true;
+ itr->second->state = PLAYERSPELL_REMOVED;
itr = GetSpellMap().begin();
continue;
}