[9694] Not crash in case unknown spell expected to be learned at spec switch.

It will output error insteed and continue.
This commit is contained in:
VladimirMangos 2010-04-08 05:47:08 +04:00
parent 93bc46b1f3
commit 45fba95d13
2 changed files with 19 additions and 4 deletions

View file

@ -21733,20 +21733,35 @@ void Player::ActivateSpec(uint8 specNum)
continue;
}
uint32 talentSpellId = talent.m_talentEntry->RankID[talent.currentRank];
// learn talent spells if they not in new spec (old spec copy)
// and if they have different rank
PlayerTalentMap::iterator specIter = m_talents[m_activeSpec].find(tempIter->first);
if (specIter != m_talents[m_activeSpec].end() && specIter->second.state != PLAYERSPELL_REMOVED)
{
if ((*specIter).second.currentRank != talent.currentRank)
learnSpell(talent.m_talentEntry->RankID[talent.currentRank], false);
learnSpell(talentSpellId, false);
}
else
learnSpell(talent.m_talentEntry->RankID[talent.currentRank], false);
learnSpell(talentSpellId, false);
// sync states - original state is changed in addSpell that learnSpell calls
specIter = m_talents[m_activeSpec].find(tempIter->first);
(*specIter).second.state = talent.state;
if (specIter != m_talents[m_activeSpec].end())
(*specIter).second.state = talent.state;
else
{
sLog.outError("ActivateSpec: Talent spell %u expected to learned at spec switch but not listed in talents at final check!", talentSpellId);
// attempt resync DB state (deleted lost spell from DB)
if (talent.state != PLAYERSPELL_NEW)
{
PlayerTalent& talentNew = m_talents[m_activeSpec][tempIter->first];
talentNew = talent;
talentNew.state = PLAYERSPELL_REMOVED;
}
}
}
InitTalentForLevel();

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "9693"
#define REVISION_NR "9694"
#endif // __REVISION_NR_H__