[8261] Skip not in world targets in same way as not existed targets.

This solve some crash possabilites after GetMap patch.
This commit is contained in:
VladimirMangos 2009-07-27 22:09:22 +04:00
parent 38326edb12
commit 8720687bdb
2 changed files with 8 additions and 8 deletions

View file

@ -43,18 +43,18 @@ template<class T>
void
TargetedMovementGenerator<T>::_setTargetLocation(T &owner)
{
if( !i_target.isValid() || !&owner )
if (!i_target.isValid() || !i_target->IsInWorld())
return;
if( owner.hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_DISTRACTED) )
if (owner.hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_DISTRACTED))
return;
// prevent redundant micro-movement for pets, other followers.
if(i_offset && i_target->IsWithinDistInMap(&owner,2*i_offset))
if (i_offset && i_target->IsWithinDistInMap(&owner,2*i_offset))
return;
float x, y, z;
if(!i_offset)
if (!i_offset)
{
// to nearest contact position
i_target->GetContactPoint( &owner, x, y, z );
@ -126,13 +126,13 @@ template<class T>
bool
TargetedMovementGenerator<T>::Update(T &owner, const uint32 & time_diff)
{
if(!i_target.isValid())
if (!i_target.isValid() || !i_target->IsInWorld())
return false;
if( !&owner || !owner.isAlive())
if (!owner.isAlive())
return true;
if( owner.hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_FLEEING | UNIT_STAT_DISTRACTED) )
if (owner.hasUnitState(UNIT_STAT_ROOT | UNIT_STAT_STUNNED | UNIT_STAT_FLEEING | UNIT_STAT_DISTRACTED))
return true;
// prevent movement while casting spells with cast time or channel time