mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 10:37:02 +00:00
[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:
parent
38326edb12
commit
8720687bdb
2 changed files with 8 additions and 8 deletions
|
|
@ -43,18 +43,18 @@ template<class T>
|
||||||
void
|
void
|
||||||
TargetedMovementGenerator<T>::_setTargetLocation(T &owner)
|
TargetedMovementGenerator<T>::_setTargetLocation(T &owner)
|
||||||
{
|
{
|
||||||
if( !i_target.isValid() || !&owner )
|
if (!i_target.isValid() || !i_target->IsInWorld())
|
||||||
return;
|
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;
|
return;
|
||||||
|
|
||||||
// prevent redundant micro-movement for pets, other followers.
|
// 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;
|
return;
|
||||||
|
|
||||||
float x, y, z;
|
float x, y, z;
|
||||||
if(!i_offset)
|
if (!i_offset)
|
||||||
{
|
{
|
||||||
// to nearest contact position
|
// to nearest contact position
|
||||||
i_target->GetContactPoint( &owner, x, y, z );
|
i_target->GetContactPoint( &owner, x, y, z );
|
||||||
|
|
@ -126,13 +126,13 @@ template<class T>
|
||||||
bool
|
bool
|
||||||
TargetedMovementGenerator<T>::Update(T &owner, const uint32 & time_diff)
|
TargetedMovementGenerator<T>::Update(T &owner, const uint32 & time_diff)
|
||||||
{
|
{
|
||||||
if(!i_target.isValid())
|
if (!i_target.isValid() || !i_target->IsInWorld())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if( !&owner || !owner.isAlive())
|
if (!owner.isAlive())
|
||||||
return true;
|
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;
|
return true;
|
||||||
|
|
||||||
// prevent movement while casting spells with cast time or channel time
|
// prevent movement while casting spells with cast time or channel time
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "8260"
|
#define REVISION_NR "8261"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue