*Search for aura caster in our out of world in Aura::UnregisterSingleTarget().

--HG--
branch : trunk
This commit is contained in:
QAston
2010-08-02 18:05:07 +02:00
parent 027ca9b62a
commit 18dd177308
3 changed files with 18 additions and 2 deletions
+15
View File
@@ -98,6 +98,21 @@ class ObjectAccessor
// TODO: override these template functions for each holder type and add assertions
template<class T> static T* GetObjectInOrOutOfWorld(uint64 guid, T* /*typeSpecifier*/)
{
return HashMapHolder<T>::Find(guid);
}
static Unit* GetObjectInOrOutOfWorld(uint64 guid, Unit* /*typeSpecifier*/)
{
if (IS_PLAYER_GUID(guid))
return (Unit*)GetObjectInOrOutOfWorld(guid, (Player*)NULL);
if (IS_PET_GUID(guid))
return (Unit*)GetObjectInOrOutOfWorld(guid, (Pet*)NULL);
return (Unit*)GetObjectInOrOutOfWorld(guid, (Creature*)NULL);
}
// returns object if is in world
template<class T> static T* GetObjectInWorld(uint64 guid, T* /*typeSpecifier*/)
{
+2 -1
View File
@@ -764,7 +764,8 @@ bool Aura::IsVisible() const
void Aura::UnregisterSingleTarget()
{
ASSERT(m_isSingleTarget);
Unit * caster = GetCaster();
Unit * caster = ObjectAccessor::GetObjectInOrOutOfWorld(GetCasterGUID(), (Unit*)NULL);//GetCaster();
assert(caster);
caster->GetSingleCastAuras().remove(this);
SetIsSingleTarget(false);
}
+1 -1
View File
@@ -264,7 +264,7 @@ bool SpellCastTargets::read (WorldPacket * data, Unit *caster)
if (!(m_targetMask & TARGET_FLAG_SOURCE_LOCATION))
m_srcPos.Relocate(caster);
if (!(m_targetMask & TARGET_FLAG_DEST_LOCATION)
if (!(m_targetMask & TARGET_FLAG_DEST_LOCATION))
m_dstPos.Relocate(caster);
// find real units/GOs