aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormegamage <none@none>2008-12-03 18:35:00 -0600
committermegamage <none@none>2008-12-03 18:35:00 -0600
commit48ca955bd36d33ea12cfd24a61730a6ae61ffc86 (patch)
tree09e7f0872acc83a4867c146995780eb29aaecf44 /src
parentc1f49df3da3628adb2866cc5f5cf95c78ba80955 (diff)
*Update persistant auras every 500ms. (I do not know if persistant auras can be resisted. If not, then this patch may be useless)
--HG-- branch : trunk
Diffstat (limited to 'src')
-rw-r--r--src/game/DynamicObject.cpp27
-rw-r--r--src/game/DynamicObject.h1
2 files changed, 17 insertions, 11 deletions
diff --git a/src/game/DynamicObject.cpp b/src/game/DynamicObject.cpp
index 50539796ab3..672870f223c 100644
--- a/src/game/DynamicObject.cpp
+++ b/src/game/DynamicObject.cpp
@@ -86,6 +86,7 @@ bool DynamicObject::Create( uint32 guidlow, Unit *caster, uint32 spellId, uint32
m_effIndex = effIndex;
m_spellId = spellId;
m_casterGuid = caster->GetGUID();
+ m_updateTimer = 0;
return true;
}
@@ -112,20 +113,24 @@ void DynamicObject::Update(uint32 p_time)
else
deleteThis = true;
- // TODO: make a timer and update this in larger intervals
- CellPair p(Trinity::ComputeCellPair(GetPositionX(), GetPositionY()));
- Cell cell(p);
- cell.data.Part.reserved = ALL_DISTRICT;
- cell.SetNoCreate();
+ if(m_updateTimer < p_time)
+ {
+ CellPair p(Trinity::ComputeCellPair(GetPositionX(), GetPositionY()));
+ Cell cell(p);
+ cell.data.Part.reserved = ALL_DISTRICT;
+ cell.SetNoCreate();
+
+ Trinity::DynamicObjectUpdater notifier(*this,caster);
- Trinity::DynamicObjectUpdater notifier(*this,caster);
+ TypeContainerVisitor<Trinity::DynamicObjectUpdater, WorldTypeMapContainer > world_object_notifier(notifier);
+ TypeContainerVisitor<Trinity::DynamicObjectUpdater, GridTypeMapContainer > grid_object_notifier(notifier);
- TypeContainerVisitor<Trinity::DynamicObjectUpdater, WorldTypeMapContainer > world_object_notifier(notifier);
- TypeContainerVisitor<Trinity::DynamicObjectUpdater, GridTypeMapContainer > grid_object_notifier(notifier);
+ CellLock<GridReadGuard> cell_lock(cell, p);
+ cell_lock->Visit(cell_lock, world_object_notifier, *GetMap());
+ cell_lock->Visit(cell_lock, grid_object_notifier, *GetMap());
- CellLock<GridReadGuard> cell_lock(cell, p);
- cell_lock->Visit(cell_lock, world_object_notifier, *MapManager::Instance().GetMap(GetMapId(), this));
- cell_lock->Visit(cell_lock, grid_object_notifier, *MapManager::Instance().GetMap(GetMapId(), this));
+ m_updateTimer = 500; // is this official-like?
+ }else m_updateTimer -= p_time;
if(deleteThis)
{
diff --git a/src/game/DynamicObject.h b/src/game/DynamicObject.h
index 2d5efb3c596..a27be9a521c 100644
--- a/src/game/DynamicObject.h
+++ b/src/game/DynamicObject.h
@@ -65,6 +65,7 @@ class DynamicObject : public WorldObject
uint32 m_spellId;
uint32 m_effIndex;
int32 m_aliveDuration;
+ uint32 m_updateTimer;
time_t m_nextThinkTime;
float m_radius;
AffectedSet m_affected;