[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:
+13
-4
@@ -1623,8 +1623,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
|
||||
@@ -1636,8 +1641,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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user