[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,10 +1677,15 @@ void Pet::ToggleAutocast(uint32 spellid, bool apply)
if (i == m_autospells.size())
{
m_autospells.push_back(spellid);
if(itr->second->active != ACT_ENABLED)
{
itr->second->active = ACT_ENABLED;
if(itr->second->state != PETSPELL_NEW)
itr->second->state = PETSPELL_CHANGED;
}
}
}
else
{
AutoSpellList::iterator itr2 = m_autospells.begin();
@ -1690,10 +1695,14 @@ void Pet::ToggleAutocast(uint32 spellid, bool apply)
if (i < m_autospells.size())
{
m_autospells.erase(itr2);
if(itr->second->active != ACT_DISABLED)
{
itr->second->active = ACT_DISABLED;
if(itr->second->state != PETSPELL_NEW)
itr->second->state = PETSPELL_CHANGED;
}
}
}
}
bool Pet::Create(uint32 guidlow, Map *map, uint32 phaseMask, uint32 Entry, uint32 pet_number)

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__