*Fix a crash when statues are killed.
--HG-- branch : trunk
This commit is contained in:
+9
-3
@@ -2116,8 +2116,11 @@ void Spell::cancel()
|
|||||||
if(m_spellState == SPELL_STATE_FINISHED)
|
if(m_spellState == SPELL_STATE_FINISHED)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
uint32 oldState = m_spellState;
|
||||||
|
m_spellState = SPELL_STATE_FINISHED;
|
||||||
|
|
||||||
m_autoRepeat = false;
|
m_autoRepeat = false;
|
||||||
switch (m_spellState)
|
switch (oldState)
|
||||||
{
|
{
|
||||||
case SPELL_STATE_PREPARING:
|
case SPELL_STATE_PREPARING:
|
||||||
case SPELL_STATE_DELAYED:
|
case SPELL_STATE_DELAYED:
|
||||||
@@ -2149,10 +2152,13 @@ void Spell::cancel()
|
|||||||
} break;
|
} break;
|
||||||
}
|
}
|
||||||
|
|
||||||
finish(false);
|
|
||||||
|
|
||||||
m_caster->RemoveDynObject(m_spellInfo->Id);
|
m_caster->RemoveDynObject(m_spellInfo->Id);
|
||||||
m_caster->RemoveGameObject(m_spellInfo->Id,true);
|
m_caster->RemoveGameObject(m_spellInfo->Id,true);
|
||||||
|
|
||||||
|
//set state back so finish will be processed
|
||||||
|
m_spellState = oldState;
|
||||||
|
|
||||||
|
finish(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Spell::cast(bool skipCheck)
|
void Spell::cast(bool skipCheck)
|
||||||
|
|||||||
+5
-5
@@ -4706,13 +4706,10 @@ void Unit::RemoveAura(AuraMap::iterator &i, AuraRemoveMode mode)
|
|||||||
if(!caster) // can be already located for IsSingleTargetSpell case
|
if(!caster) // can be already located for IsSingleTargetSpell case
|
||||||
caster = Aur->GetCaster();
|
caster = Aur->GetCaster();
|
||||||
|
|
||||||
if(caster)
|
if(caster && caster->isAlive())
|
||||||
{
|
{
|
||||||
if(caster->GetTypeId()==TYPEID_UNIT && ((Creature*)caster)->isTotem() && ((Totem*)caster)->GetTotemType()==TOTEM_STATUE)
|
|
||||||
statue = ((Totem*)caster);
|
|
||||||
|
|
||||||
// stop caster chanelling state
|
// stop caster chanelling state
|
||||||
else if(caster->m_currentSpells[CURRENT_CHANNELED_SPELL]
|
if(caster->m_currentSpells[CURRENT_CHANNELED_SPELL]
|
||||||
//prevent recurential call
|
//prevent recurential call
|
||||||
&& caster->m_currentSpells[CURRENT_CHANNELED_SPELL]->getState() != SPELL_STATE_FINISHED)
|
&& caster->m_currentSpells[CURRENT_CHANNELED_SPELL]->getState() != SPELL_STATE_FINISHED)
|
||||||
{
|
{
|
||||||
@@ -4727,6 +4724,9 @@ void Unit::RemoveAura(AuraMap::iterator &i, AuraRemoveMode mode)
|
|||||||
caster->m_currentSpells[CURRENT_CHANNELED_SPELL]->cancel();
|
caster->m_currentSpells[CURRENT_CHANNELED_SPELL]->cancel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(caster->GetTypeId()==TYPEID_UNIT && ((Creature*)caster)->isTotem() && ((Totem*)caster)->GetTotemType()==TOTEM_STATUE)
|
||||||
|
statue = ((Totem*)caster);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Unsummon summon as possessed creatures on spell cancel
|
// Unsummon summon as possessed creatures on spell cancel
|
||||||
|
|||||||
Reference in New Issue
Block a user