[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
+13 -4
View File
@@ -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;
}
}
}
}