@@ -2908,7 +2908,7 @@ bool Player::AddTalent(uint32 spellId, uint8 spec, bool learning)
29082908
29092909 PlayerTalentMap::iterator itr = GetTalentMap(spec)->find(spellId);
29102910 if (itr != GetTalentMap(spec)->end())
2911- itr->second-> state = PLAYERSPELL_UNCHANGED;
2911+ itr->second. state = PLAYERSPELL_UNCHANGED;
29122912 else if (TalentSpellPos const* talentPos = GetTalentSpellPos(spellId))
29132913 {
29142914 if (TalentEntry const* talentInfo = sTalentStore.LookupEntry(talentPos->talent_id))
@@ -2922,16 +2922,13 @@ bool Player::AddTalent(uint32 spellId, uint8 spec, bool learning)
29222922
29232923 itr = GetTalentMap(spec)->find(rankSpellId);
29242924 if (itr != GetTalentMap(spec)->end())
2925- itr->second-> state = PLAYERSPELL_REMOVED;
2925+ itr->second. state = PLAYERSPELL_REMOVED;
29262926 }
29272927 }
29282928
2929- PlayerTalent* newtalent = new PlayerTalent();
2930-
2931- newtalent->state = learning ? PLAYERSPELL_NEW : PLAYERSPELL_UNCHANGED;
2932- newtalent->spec = spec;
2933-
2934- (*GetTalentMap(spec))[spellId] = newtalent;
2929+ PlayerTalent& newtalent = (*GetTalentMap(spec))[spellId];
2930+ newtalent.state = learning ? PLAYERSPELL_NEW : PLAYERSPELL_UNCHANGED;
2931+ newtalent.spec = spec;
29352932 return true;
29362933 }
29372934 return false;
@@ -3770,7 +3767,7 @@ bool Player::ResetTalents(bool involuntarily /*= false*/)
37703767 // if this talent rank can be found in the PlayerTalentMap, mark the talent as removed so it gets deleted
37713768 PlayerTalentMap::iterator plrTalent = GetTalentMap(GetActiveSpec())->find(talentInfo->SpellRank[rank]);
37723769 if (plrTalent != GetTalentMap(GetActiveSpec())->end())
3773- plrTalent->second-> state = PLAYERSPELL_REMOVED;
3770+ plrTalent->second. state = PLAYERSPELL_REMOVED;
37743771 }
37753772 }
37763773
@@ -3874,7 +3871,7 @@ bool Player::HasSpell(uint32 spell) const
38743871bool Player::HasTalent(uint32 spell, uint8 spec) const
38753872{
38763873 PlayerTalentMap::const_iterator itr = GetTalentMap(spec)->find(spell);
3877- return (itr != GetTalentMap(spec)->end() && itr->second-> state != PLAYERSPELL_REMOVED);
3874+ return (itr != GetTalentMap(spec)->end() && itr->second. state != PLAYERSPELL_REMOVED);
38783875}
38793876
38803877bool Player::HasActiveSpell(uint32 spell) const
@@ -25728,32 +25725,31 @@ void Player::_SaveTalents(CharacterDatabaseTransaction trans)
2572825725 {
2572925726 for (PlayerTalentMap::iterator itr = GetTalentMap(i)->begin(); itr != GetTalentMap(i)->end();)
2573025727 {
25731- if (itr->second-> state == PLAYERSPELL_REMOVED || itr->second-> state == PLAYERSPELL_CHANGED)
25728+ if (itr->second. state == PLAYERSPELL_REMOVED || itr->second. state == PLAYERSPELL_CHANGED)
2573225729 {
2573325730 stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_TALENT_BY_SPELL_SPEC);
2573425731 stmt->setUInt32(0, GetGUID().GetCounter());
2573525732 stmt->setUInt32(1, itr->first);
25736- stmt->setUInt8(2, itr->second-> spec);
25733+ stmt->setUInt8(2, itr->second. spec);
2573725734 trans->Append(stmt);
2573825735 }
2573925736
25740- if (itr->second-> state == PLAYERSPELL_NEW || itr->second-> state == PLAYERSPELL_CHANGED)
25737+ if (itr->second. state == PLAYERSPELL_NEW || itr->second. state == PLAYERSPELL_CHANGED)
2574125738 {
2574225739 stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_TALENT);
2574325740 stmt->setUInt32(0, GetGUID().GetCounter());
2574425741 stmt->setUInt32(1, itr->first);
25745- stmt->setUInt8(2, itr->second-> spec);
25742+ stmt->setUInt8(2, itr->second. spec);
2574625743 trans->Append(stmt);
2574725744 }
2574825745
25749- if (itr->second-> state == PLAYERSPELL_REMOVED)
25746+ if (itr->second. state == PLAYERSPELL_REMOVED)
2575025747 {
25751- delete itr->second;
25752- GetTalentMap(i)->erase(itr++);
25748+ itr = GetTalentMap(i)->erase(itr);
2575325749 }
2575425750 else
2575525751 {
25756- itr->second-> state = PLAYERSPELL_UNCHANGED;
25752+ itr->second. state = PLAYERSPELL_UNCHANGED;
2575725753 ++itr;
2575825754 }
2575925755 }
0 commit comments