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

--HG--
branch : trunk
This commit is contained in:
megamage
2009-05-03 22:27:39 -05:00
parent d2096abe1c
commit bb37911480
+9
View File
@@ -1623,10 +1623,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();
@@ -1636,11 +1641,15 @@ 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)
{