mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 22:37:03 +00:00
[7826] Avoid use GetDistance* that used slow sqrt call where possible, other related speedups.
This commit is contained in:
parent
ff80f14d2d
commit
788cdf9b3a
21 changed files with 158 additions and 93 deletions
|
|
@ -1778,12 +1778,12 @@ bool Creature::IsOutOfThreatArea(Unit* pVictim) const
|
|||
if(sMapStore.LookupEntry(GetMapId())->IsDungeon())
|
||||
return false;
|
||||
|
||||
float length = pVictim->GetDistance(CombatStartX,CombatStartY,CombatStartZ);
|
||||
float AttackDist = GetAttackDistance(pVictim);
|
||||
uint32 ThreatRadius = sWorld.getConfig(CONFIG_THREAT_RADIUS);
|
||||
|
||||
//Use AttackDistance in distance check if threat radius is lower. This prevents creature bounce in and out of combat every update tick.
|
||||
return ( length > (ThreatRadius > AttackDist ? ThreatRadius : AttackDist));
|
||||
return !pVictim->IsWithinDist(CombatStartX,CombatStartY,CombatStartZ,
|
||||
ThreatRadius > AttackDist ? ThreatRadius : AttackDist);
|
||||
}
|
||||
|
||||
CreatureDataAddon const* Creature::GetCreatureAddon() const
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue