[7751] Use more safe code to prevent DB errors at pet spells save and avoid unneded data save.

This commit is contained in:
VladimirMangos 2009-05-04 04:53:56 +04:00
parent 56401e1494
commit 4561dec27e
2 changed files with 14 additions and 5 deletions

View file

@ -1677,8 +1677,13 @@ void Pet::ToggleAutocast(uint32 spellid, bool apply)
if (i == m_autospells.size())
{
m_autospells.push_back(spellid);
itr->second->active = ACT_ENABLED;
itr->second->state = PETSPELL_CHANGED;
if(itr->second->active != ACT_ENABLED)
{
itr->second->active = ACT_ENABLED;
if(itr->second->state != PETSPELL_NEW)
itr->second->state = PETSPELL_CHANGED;
}
}
}
else
@ -1690,8 +1695,12 @@ void Pet::ToggleAutocast(uint32 spellid, bool apply)
if (i < m_autospells.size())
{
m_autospells.erase(itr2);
itr->second->active = ACT_DISABLED;
itr->second->state = PETSPELL_CHANGED;
if(itr->second->active != ACT_DISABLED)
{
itr->second->active = ACT_DISABLED;
if(itr->second->state != PETSPELL_NEW)
itr->second->state = PETSPELL_CHANGED;
}
}
}
}

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "7750"
#define REVISION_NR "7751"
#endif // __REVISION_NR_H__