[9461] Some another cases when movegen can be lost while updating.

This commit is contained in:
VladimirMangos 2010-02-27 01:20:15 +03:00
parent 01e05f5d7e
commit c179c45087
5 changed files with 16 additions and 3 deletions

View file

@ -177,8 +177,13 @@ bool WaypointMovementGenerator<Creature>::Update(Creature &creature, const uint3
creature.SetUInt32Value(UNIT_NPC_EMOTESTATE, behavior->emote);
if (behavior->spell != 0)
{
creature.CastSpell(&creature, behavior->spell, false);
if (!IsActive(creature)) // force stop processing (cast can change movegens list)
return true; // not expire now, but already lost
}
if (behavior->model1 != 0)
creature.SetDisplayId(behavior->model1);