mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 13:37:05 +00:00
[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:
parent
9f41772828
commit
9f938a9ed4
17 changed files with 220 additions and 40 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue