*Remove some incorrect use of removefromworld in scripts.

--HG--
branch : trunk
This commit is contained in:
megamage
2009-08-13 10:21:57 -05:00
parent c84f63d431
commit 656cb8a318
6 changed files with 16 additions and 13 deletions
@@ -517,7 +517,7 @@ struct TRINITY_DLL_DECL npc_geezleAI : public ScriptedAI
{ {
//TODO: Found how to despawn and respawn //TODO: Found how to despawn and respawn
if(despawn) if(despawn)
(*itr)->RemoveFromWorld(); (*itr)->Delete();
else else
(*itr)->Respawn(); (*itr)->Respawn();
} }
@@ -730,7 +730,7 @@ void hyjalAI::DeSpawnVeins()
for (uint8 i = 0; i<7; i++) for (uint8 i = 0; i<7; i++)
{ {
if (GameObject* gem = pInstance->instance->GetGameObject(pInstance->GetData64(ai->VeinGUID[i]))) if (GameObject* gem = pInstance->instance->GetGameObject(pInstance->GetData64(ai->VeinGUID[i])))
gem->RemoveFromWorld(); gem->Delete();
} }
}else if (Faction) }else if (Faction)
{ {
@@ -741,7 +741,7 @@ void hyjalAI::DeSpawnVeins()
for (uint8 i = 7; i<14; i++) for (uint8 i = 7; i<14; i++)
{ {
if(GameObject* gem = pInstance->instance->GetGameObject(pInstance->GetData64(ai->VeinGUID[i]))) if(GameObject* gem = pInstance->instance->GetGameObject(pInstance->GetData64(ai->VeinGUID[i])))
gem->RemoveFromWorld(); gem->Delete();
} }
} }
} }
@@ -209,9 +209,8 @@ struct TRINITY_DLL_DECL boss_leotheras_the_blindAI : public ScriptedAI
{ {
for(uint8 i = 0; i < 3; i++) for(uint8 i = 0; i < 3; i++)
{ {
Creature *add = Unit::GetCreature(*m_creature,SpellBinderGUID[i]); if(Creature *add = Unit::GetCreature(*m_creature,SpellBinderGUID[i]))
if (add) add->DisappearAndDie();
add->RemoveFromWorld();
float nx = x; float nx = x;
float ny = y; float ny = y;
@@ -282,7 +282,7 @@ bool GOHello_go_orb_of_the_blue_flight(Player *plr, GameObject* go)
if(Dyn){ if(Dyn){
Dyn->GetPosition(dx,dy,dz); Dyn->GetPosition(dx,dy,dz);
if(x == dx && dy == y && dz == z){ if(x == dx && dy == y && dz == z){
Dyn->RemoveFromWorld(); Dyn->Delete();
break; break;
} }
} }
@@ -369,7 +369,7 @@ struct TRINITY_DLL_DECL boss_kalecgos_kjAI : public ScriptedAI
if(Dyn){ if(Dyn){
Dyn->GetPosition(dx,dy,dz); Dyn->GetPosition(dx,dy,dz);
if(x == dx && dy == y && dz == z){ if(x == dx && dy == y && dz == z){
Dyn->RemoveFromWorld(); Dyn->Delete();
break; break;
} }
} }
@@ -64,9 +64,8 @@ struct TRINITY_DLL_DECL boss_emalonAI : public ScriptedAI
{ {
for(std::list<uint64>::const_iterator itr = MinionList.begin(); itr != MinionList.end(); itr++) for(std::list<uint64>::const_iterator itr = MinionList.begin(); itr != MinionList.end(); itr++)
{ {
Unit *Minion = Unit::GetUnit(*m_creature, (*itr)); if(Creature *Minion = Unit::GetCreature(*m_creature, (*itr)))
if(Minion) Minion->DisappearAndDie();
Minion->RemoveFromWorld();
} }
} }
@@ -220,8 +219,7 @@ struct TRINITY_DLL_DECL mob_tempest_minionAI : public ScriptedAI
void JustDied(Unit* Killer) void JustDied(Unit* Killer)
{ {
m_creature->RemoveCorpse(); m_creature->DisappearAndDie();
m_creature->RemoveFromWorld();
if(Emalon) if(Emalon)
{ {
boss_emalonAI::SummonMinion(Emalon, Emalon->GetPositionX(), Emalon->GetPositionY(), Emalon->GetPositionZ(), Emalon->GetOrientation()); boss_emalonAI::SummonMinion(Emalon, Emalon->GetPositionX(), Emalon->GetPositionY(), Emalon->GetPositionZ(), Emalon->GetOrientation());
+6
View File
@@ -490,6 +490,12 @@ class TRINITY_DLL_SPEC Creature : public Unit
void AddToWorld(); void AddToWorld();
void RemoveFromWorld(); void RemoveFromWorld();
void DisappearAndDie()
{
SetVisibility(VISIBILITY_OFF);
setDeathState(JUST_DIED);
}
bool Create(uint32 guidlow, Map *map, uint32 phaseMask, uint32 Entry, uint32 team, float x, float y, float z, float ang, const CreatureData *data = NULL); bool Create(uint32 guidlow, Map *map, uint32 phaseMask, uint32 Entry, uint32 team, float x, float y, float z, float ang, const CreatureData *data = NULL);
bool LoadCreaturesAddon(bool reload = false); bool LoadCreaturesAddon(bool reload = false);
void SelectLevel(const CreatureInfo *cinfo); void SelectLevel(const CreatureInfo *cinfo);