aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormegamage <none@none>2009-05-03 22:27:39 -0500
committermegamage <none@none>2009-05-03 22:27:39 -0500
commitbb37911480995e432daf1c6dad31ccd4616c23ae (patch)
tree2c1052e8abefc09b13f92dd8cc02cd9ea109e30e /src
parentd2096abe1ccbdfb031ceb9f6a103a7c4f711377a (diff)
[7751] Use more safe code to prevent DB errors at pet spells save and avoid unneded data save. Author: VladimirMangos
--HG-- branch : trunk
Diffstat (limited to 'src')
-rw-r--r--src/game/Pet.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/game/Pet.cpp b/src/game/Pet.cpp
index 8985d648cff..0c7e3970a94 100644
--- a/src/game/Pet.cpp
+++ b/src/game/Pet.cpp
@@ -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;
+ }
}
}
}