diff options
author | QAston <none@none> | 2010-01-19 22:15:04 +0100 |
---|---|---|
committer | QAston <none@none> | 2010-01-19 22:15:04 +0100 |
commit | 6e76e6725353638a79c6f55dcb236e35707ec3f3 (patch) | |
tree | f5d9914d3ff05efd80091e300850b90b851f6e9c | |
parent | 7ef6842cf3a005dcb0c9dca66ad4cb252a2368e4 (diff) |
*Fix petAi::Update crash.
--HG--
branch : trunk
-rw-r--r-- | src/game/PetAI.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/game/PetAI.cpp b/src/game/PetAI.cpp index af9c7e60457..d70b0c1be1f 100644 --- a/src/game/PetAI.cpp +++ b/src/game/PetAI.cpp @@ -115,8 +115,6 @@ void PetAI::UpdateAI(const uint32 diff) if(!me->GetCharmInfo()) return; - bool inCombat = me->getVictim(); - // Autocast (casted only in combat or persistent spells in any state) if (m_creature->GetGlobalCooldown() == 0 && !m_creature->hasUnitState(UNIT_STAT_CASTING)) { @@ -134,7 +132,7 @@ void PetAI::UpdateAI(const uint32 diff) continue; // ignore some combinations of combat state and combat/noncombat spells - if (!inCombat) + if (!me->getVictim()) { // ignore attacking spells, and allow only self/around spells if (!IsPositiveSpell(spellInfo->Id)) @@ -166,7 +164,7 @@ void PetAI::UpdateAI(const uint32 diff) Spell *spell = new Spell(m_creature, spellInfo, false, 0); // Fix to allow pets on STAY to autocast - if (inCombat && _CanAttack(me->getVictim()) && spell->CanAutoCast(me->getVictim())) + if (me->getVictim() && _CanAttack(me->getVictim()) && spell->CanAutoCast(me->getVictim())) { targetSpellStore.push_back(std::make_pair<Unit*, Spell*>(m_creature->getVictim(), spell)); continue; |