Make a function(ToTempSummon()) which can convert Creature to TempSummon with a C++ cast(reinterpret_cast) and with a type check(isSummon()).

This function is like ToPlayer(), ToTotem(), etc.

This commit is like ede831bdd6f0cff481acc33f269fa7f8c78befd4 / r7496:
http://code.google.com/p/trinitycore/source/detail?r=ede831bdd6f0cff481acc33f269fa7f8c78befd4
As a result, this commit has the advantages and the "disadvantages" too, like r7496.

Please try to be polite if this commit causes some crashes.

--HG--
branch : trunk
This commit is contained in:
Anubisss
2010-03-27 16:08:14 +01:00
parent 769f54eedf
commit ce8cc85dfa
9 changed files with 16 additions and 14 deletions

View File

@@ -5456,7 +5456,7 @@ void Spell::EffectScriptEffect(uint32 effIndex)
case 52173: // Coyote Spirit Despawn
case 60243: // Blood Parrot Despawn
if (unitTarget->GetTypeId() == TYPEID_UNIT && unitTarget->ToCreature()->isSummon())
((TempSummon*)unitTarget)->UnSummon();
unitTarget->ToTempSummon()->UnSummon();
return;
// Sky Darkener Assault
case 52124:
@@ -5664,10 +5664,10 @@ void Spell::EffectScriptEffect(uint32 effIndex)
if(chargesaura && chargesaura->GetCharges() > 1)
{
chargesaura->SetCharges(chargesaura->GetCharges() - 1);
m_caster->CastSpell(unitTarget, spell_heal, true, NULL, NULL, ((TempSummon*)m_caster)->GetSummonerGUID());
m_caster->CastSpell(unitTarget, spell_heal, true, NULL, NULL, m_caster->ToTempSummon()->GetSummonerGUID());
}
else
((TempSummon*)m_caster)->UnSummon();
m_caster->ToTempSummon()->UnSummon();
return;
}
// Stoneclaw Totem