aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorQAston <none@none>2010-01-22 18:06:01 +0100
committerQAston <none@none>2010-01-22 18:06:01 +0100
commitc1aa60aaab82733ebb91ce31281f85edf8e7618d (patch)
tree44de82d7e0df6d141c0e38175ad91eedd46e1575 /src
parent7bfea3fea3397f936046c1856840a3a9def8ee6a (diff)
*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
Diffstat (limited to 'src')
-rw-r--r--src/game/SpellAuras.cpp8
-rw-r--r--src/game/SpellAuras.h4
-rw-r--r--src/game/Unit.cpp1
3 files changed, 11 insertions, 2 deletions
diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp
index a3128ba7567..ebdd2747181 100644
--- a/src/game/SpellAuras.cpp
+++ b/src/game/SpellAuras.cpp
@@ -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);
- UpdateTargetMap(caster);
+ if (m_updateTargetMapInterval <= diff)
+ UpdateTargetMap(caster);
+ else
+ m_updateTargetMapInterval -= diff;
// update aura effects
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
diff --git a/src/game/SpellAuras.h b/src/game/SpellAuras.h
index 8d0a11c4877..dfa5fca6432 100644
--- a/src/game/SpellAuras.h
+++ b/src/game/SpellAuras.h
@@ -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)
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index 915410430f3..026ff352445 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -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())