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