*Run grid searches for area auras every 500ms instead of every unit update
*Fix a stupid typo which caused memory leak in Unit::RemoveOwnedAura --HG-- branch : trunk
This commit is contained in:
@@ -332,7 +332,7 @@ Aura * Aura::Create(SpellEntry const* spellproto, uint8 effMask, WorldObject * o
|
||||
|
||||
Aura::Aura(SpellEntry const* spellproto, uint8 effMask, WorldObject * owner, Unit * caster, int32 *baseAmount, Item * castItem, uint64 casterGUID) :
|
||||
m_spellProto(spellproto), m_owner(owner), m_casterGuid(casterGUID ? casterGUID : caster->GetGUID()), m_castItemGuid(castItem ? castItem->GetGUID() : 0),
|
||||
m_applyTime(time(NULL)), m_timeCla(0), m_isSingleTarget(false),
|
||||
m_applyTime(time(NULL)), m_timeCla(0), m_isSingleTarget(false), m_updateTargetMapInterval(0),
|
||||
m_procCharges(0), m_stackAmount(1), m_isRemoved(false), m_casterLevel(caster ? caster->getLevel() : m_spellProto->spellLevel)
|
||||
{
|
||||
if(m_spellProto->manaPerSecond || m_spellProto->manaPerSecondPerLevel)
|
||||
@@ -453,6 +453,7 @@ void Aura::_Remove(AuraRemoveMode removeMode)
|
||||
|
||||
void Aura::UpdateTargetMap(Unit * caster)
|
||||
{
|
||||
m_updateTargetMapInterval = UPDATE_TARGET_MAP_INTERVAL;
|
||||
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
|
||||
if(m_effects[i] && !IsRemoved())
|
||||
UpdateTargetMapForEffect(caster, i);
|
||||
@@ -474,7 +475,10 @@ void Aura::UpdateOwner(uint32 diff, WorldObject * owner)
|
||||
|
||||
Update(diff, caster);
|
||||
|
||||
if (m_updateTargetMapInterval <= diff)
|
||||
UpdateTargetMap(caster);
|
||||
else
|
||||
m_updateTargetMapInterval -= diff;
|
||||
|
||||
// update aura effects
|
||||
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
|
||||
|
||||
@@ -33,6 +33,9 @@ class AuraEffect;
|
||||
class Aura;
|
||||
class DynamicObject;
|
||||
|
||||
// update aura target map every 500 ms instead of every update - reduce amount of grid searcher calls
|
||||
#define UPDATE_TARGET_MAP_INTERVAL 500
|
||||
|
||||
class AuraApplication
|
||||
{
|
||||
friend AuraApplication * Unit::__ApplyAura(Aura * aura);
|
||||
@@ -172,6 +175,7 @@ class TRINITY_DLL_SPEC Aura
|
||||
int32 m_maxDuration; // Max aura duration
|
||||
int32 m_duration; // Current time
|
||||
int32 m_timeCla; // Timer for power per sec calcultion
|
||||
int32 m_updateTargetMapInterval; // Timer for UpdateTargetMapOfEffect
|
||||
|
||||
uint8 const m_casterLevel; // Aura level (store caster level for correct show level dep amount)
|
||||
uint8 m_procCharges; // Aura charges (0 for infinite)
|
||||
|
||||
@@ -3885,6 +3885,7 @@ void Unit::RemoveOwnedAura(AuraMap::iterator &i, AuraRemoveMode removeMode)
|
||||
++m_auraUpdateIterator;
|
||||
|
||||
m_ownedAuras.erase(i);
|
||||
m_removedAuras.push_back(aura);
|
||||
|
||||
// Unregister single target aura
|
||||
if (aura->IsSingleTarget())
|
||||
|
||||
Reference in New Issue
Block a user