*Try to fix the crash caused by boss_priestess_delrissa script.

--HG--
branch : trunk
This commit is contained in:
megamage
2009-03-23 16:06:04 -06:00
parent ba957ed9f4
commit 2c6e5a4b23

View File

@@ -176,29 +176,24 @@ struct TRINITY_DLL_DECL boss_priestess_delrissaAI : public ScriptedAI
if (Adds.empty())
return;
for(uint8 i = 0; i < Adds.size(); ++i)
uint32 n = 0;
for(std::vector<Add*>::iterator i = Adds.begin(); i != Adds.end(); ++i, ++n)
{
bool resummon = true;
Creature* pAdd = ((Creature*)Unit::GetUnit(*m_creature, Adds[i]->guid));
if (pAdd && pAdd->isAlive())
Creature* pAdd = ((Creature*)Unit::GetUnit(*m_creature, (*i)->guid));
if(pAdd && pAdd->isAlive())
{
pAdd->AI()->EnterEvadeMode(); // Force them out of combat and reset if they are in combat.
resummon = false;
}
if (resummon)
else
{
pAdd = m_creature->SummonCreature(Adds[i]->entry, LackeyLocations[i][0], LackeyLocations[i][1], POS_Z, ORIENT, TEMPSUMMON_DEAD_DESPAWN, 0);
if (pAdd)
{
Add* nAdd = new Add(Adds[i]->entry, pAdd->GetGUID());
Adds.erase(Adds.begin() + i);
Adds.push_back(nAdd);
pAdd = m_creature->SummonCreature((*i)->entry, LackeyLocations[n][0], LackeyLocations[n][1], POS_Z, ORIENT, TEMPSUMMON_DEAD_DESPAWN, 0);
if(pAdd)
(*i)->guid = pAdd->GetGUID();
else
(*i)->guid = 0;
}
}
}
}
void KilledUnit(Unit* victim)
{