[8103] More wide use IsInWorld checks and delayed at teleport operations.

* IsInWorld used to prevent return unexpected not in world objects.
* Delayed operations need to process its in world state.

Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
Ambal 2009-07-01 12:04:58 +04:00 committed by VladimirMangos
parent 9f41772828
commit 9f938a9ed4
17 changed files with 220 additions and 40 deletions

View file

@ -176,6 +176,9 @@ Unit::~Unit()
void Unit::Update( uint32 p_time )
{
if(!IsInWorld())
return;
/*if(p_time > m_AurasCheck)
{
m_AurasCheck = 2000;
@ -7248,7 +7251,7 @@ bool Unit::Attack(Unit *victim, bool meleeAttack)
return false;
// dead units can neither attack nor be attacked
if(!isAlive() || !victim->isAlive())
if(!isAlive() || !victim->IsInWorld() || !victim->isAlive())
return false;
// player cannot attack in mount state
@ -8906,7 +8909,7 @@ bool Unit::isTargetableForAttack() const
if(HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE))
return false;
return isAlive() && !hasUnitState(UNIT_STAT_DIED)&& !isInFlight() /*&& !isStealth()*/;
return IsInWorld() && isAlive() && !hasUnitState(UNIT_STAT_DIED)&& !isInFlight() /*&& !isStealth()*/;
}
int32 Unit::ModifyHealth(int32 dVal)