*Cleanups in typecasts in spelleffects.cpp

--HG--
branch : trunk
This commit is contained in:
Azrael
2009-07-11 13:33:32 +02:00
parent 4dc5242a69
commit 024bde5fe7
+8 -19
View File
@@ -743,14 +743,11 @@ void Spell::EffectDummy(uint32 i)
{ {
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT || ((Creature*)unitTarget)->isPet()) return; if (!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT || ((Creature*)unitTarget)->isPet()) return;
Creature* creatureTarget = (Creature*)unitTarget;
GameObject* pGameObj = new GameObject; GameObject* pGameObj = new GameObject;
if (!creatureTarget || !pGameObj) return; if (!pGameObj->Create(objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), 181574, unitTarget->GetMap(), unitTarget->GetPhaseMask(),
unitTarget->GetPositionX(), unitTarget->GetPositionY(), unitTarget->GetPositionZ(),
if (!pGameObj->Create(objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), 181574, creatureTarget->GetMap(), creatureTarget->GetPhaseMask(), unitTarget->GetOrientation(), 0, 0, 0, 0, 100, GO_STATE_READY))
creatureTarget->GetPositionX(), creatureTarget->GetPositionY(), creatureTarget->GetPositionZ(),
creatureTarget->GetOrientation(), 0, 0, 0, 0, 100, GO_STATE_READY))
{ {
delete pGameObj; delete pGameObj;
return; return;
@@ -761,7 +758,7 @@ void Spell::EffectDummy(uint32 i)
//pGameObj->SetUInt32Value(GAMEOBJECT_LEVEL, m_caster->getLevel()); //pGameObj->SetUInt32Value(GAMEOBJECT_LEVEL, m_caster->getLevel());
pGameObj->SetSpellId(m_spellInfo->Id); pGameObj->SetSpellId(m_spellInfo->Id);
MapManager::Instance().GetMap(creatureTarget->GetMapId(), pGameObj)->Add(pGameObj); MapManager::Instance().GetMap(unitTarget->GetMapId(), pGameObj)->Add(pGameObj);
WorldPacket data(SMSG_GAMEOBJECT_SPAWN_ANIM_OBSOLETE, 8); WorldPacket data(SMSG_GAMEOBJECT_SPAWN_ANIM_OBSOLETE, 8);
data << uint64(pGameObj->GetGUID()); data << uint64(pGameObj->GetGUID());
@@ -907,9 +904,7 @@ void Spell::EffectDummy(uint32 i)
if(!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT) if(!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT)
return; return;
Creature* creatureTarget = (Creature*)unitTarget; ((Creature*)unitTarget)->ForcedDespawn();
creatureTarget->ForcedDespawn();
return; return;
} }
case 16589: // Noggenfogger Elixir case 16589: // Noggenfogger Elixir
@@ -961,8 +956,6 @@ void Spell::EffectDummy(uint32 i)
return; return;
Creature* creatureTarget = (Creature*)unitTarget; Creature* creatureTarget = (Creature*)unitTarget;
if(creatureTarget->isPet())
return;
GameObject* Crystal_Prison = m_caster->SummonGameObject(179644, creatureTarget->GetPositionX(), creatureTarget->GetPositionY(), creatureTarget->GetPositionZ(), creatureTarget->GetOrientation(), 0, 0, 0, 0, creatureTarget->GetRespawnTime()-time(NULL)); GameObject* Crystal_Prison = m_caster->SummonGameObject(179644, creatureTarget->GetPositionX(), creatureTarget->GetPositionY(), creatureTarget->GetPositionZ(), creatureTarget->GetOrientation(), 0, 0, 0, 0, creatureTarget->GetRespawnTime()-time(NULL));
sLog.outDebug("SummonGameObject at SpellEfects.cpp EffectDummy for Spell 23019"); sLog.outDebug("SummonGameObject at SpellEfects.cpp EffectDummy for Spell 23019");
@@ -1183,9 +1176,7 @@ void Spell::EffectDummy(uint32 i)
if(!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT) if(!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT)
return; return;
Creature* creatureTarget = (Creature*)unitTarget; ((Creature*)unitTarget)->ForcedDespawn();
creatureTarget->ForcedDespawn();
//cast spell Raptor Capture Credit //cast spell Raptor Capture Credit
m_caster->CastSpell(m_caster, 42337, true, NULL); m_caster->CastSpell(m_caster, 42337, true, NULL);
@@ -1254,9 +1245,7 @@ void Spell::EffectDummy(uint32 i)
if(!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT) if(!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT)
return; return;
Creature* creatureTarget = (Creature*)unitTarget; ((Creature*)unitTarget)->ForcedDespawn();
creatureTarget->ForcedDespawn();
return; return;
} }
@@ -4056,7 +4045,7 @@ void Spell::EffectTameCreature(uint32 /*i*/)
if(!unitTarget) if(!unitTarget)
return; return;
if(unitTarget->GetTypeId() == TYPEID_PLAYER) if(unitTarget->GetTypeId() != TYPEID_UNIT)
return; return;
Creature* creatureTarget = (Creature*)unitTarget; Creature* creatureTarget = (Creature*)unitTarget;