[10750] Convert Gameobject owner to objectguid use.

This commit is contained in:
VladimirMangos 2010-11-19 21:35:32 +03:00
parent 6154cb3b43
commit bbd34562a8
4 changed files with 9 additions and 9 deletions

View file

@ -73,7 +73,7 @@ bool DynamicObject::Create( uint32 guidlow, Unit *caster, uint32 spellId, SpellE
SetEntry(spellId); SetEntry(spellId);
SetObjectScale(DEFAULT_OBJECT_SCALE); SetObjectScale(DEFAULT_OBJECT_SCALE);
SetUInt64Value(DYNAMICOBJECT_CASTER, caster->GetGUID()); SetGuidValue(DYNAMICOBJECT_CASTER, caster->GetObjectGuid());
/* Bytes field, so it's really 4 bit fields. These flags are unknown, but we do know that 0x00000001 is set for most. /* Bytes field, so it's really 4 bit fields. These flags are unknown, but we do know that 0x00000001 is set for most.
Farsight for example, does not have this flag, instead it has 0x80000002. Farsight for example, does not have this flag, instead it has 0x80000002.
@ -103,7 +103,7 @@ bool DynamicObject::Create( uint32 guidlow, Unit *caster, uint32 spellId, SpellE
Unit* DynamicObject::GetCaster() const Unit* DynamicObject::GetCaster() const
{ {
// can be not found in some cases // can be not found in some cases
return ObjectAccessor::GetUnit(*this, GetCasterGUID()); return ObjectAccessor::GetUnit(*this, GetCasterGuid());
} }
void DynamicObject::Update(uint32 p_time) void DynamicObject::Update(uint32 p_time)
@ -152,7 +152,7 @@ void DynamicObject::Delay(int32 delaytime)
Unit *target = GetMap()->GetUnit((*iter)); Unit *target = GetMap()->GetUnit((*iter));
if (target) if (target)
{ {
SpellAuraHolder *holder = target->GetSpellAuraHolder(m_spellId, GetCasterGUID()); SpellAuraHolder *holder = target->GetSpellAuraHolder(m_spellId, GetCasterGuid().GetRawValue());
if (!holder) if (!holder)
{ {
++iter; ++iter;
@ -175,7 +175,7 @@ void DynamicObject::Delay(int32 delaytime)
continue; continue;
} }
target->DelaySpellAuraHolder(m_spellId, delaytime, GetCasterGUID()); target->DelaySpellAuraHolder(m_spellId, delaytime, GetCasterGuid().GetRawValue());
++iter; ++iter;
} }
else else
@ -185,11 +185,11 @@ void DynamicObject::Delay(int32 delaytime)
bool DynamicObject::isVisibleForInState(Player const* u, WorldObject const* viewPoint, bool inVisibleList) const bool DynamicObject::isVisibleForInState(Player const* u, WorldObject const* viewPoint, bool inVisibleList) const
{ {
if(!IsInWorld() || !u->IsInWorld()) if (!IsInWorld() || !u->IsInWorld())
return false; return false;
// always seen by owner // always seen by owner
if(GetCasterGUID()==u->GetGUID()) if (GetCasterGuid() == u->GetObjectGuid())
return true; return true;
// normal case // normal case

View file

@ -40,7 +40,7 @@ class DynamicObject : public WorldObject
uint32 GetSpellId() const { return m_spellId; } uint32 GetSpellId() const { return m_spellId; }
SpellEffectIndex GetEffIndex() const { return m_effIndex; } SpellEffectIndex GetEffIndex() const { return m_effIndex; }
uint32 GetDuration() const { return m_aliveDuration; } uint32 GetDuration() const { return m_aliveDuration; }
uint64 GetCasterGUID() const { return GetUInt64Value(DYNAMICOBJECT_CASTER); } ObjectGuid const& GetCasterGuid() const { return GetGuidValue(DYNAMICOBJECT_CASTER); }
Unit* GetCaster() const; Unit* GetCaster() const;
float GetRadius() const { return m_radius; } float GetRadius() const { return m_radius; }
bool IsAffecting(Unit *unit) const { return m_affected.find(unit->GetObjectGuid()) != m_affected.end(); } bool IsAffecting(Unit *unit) const { return m_affected.find(unit->GetObjectGuid()) != m_affected.end(); }

View file

@ -2078,7 +2078,7 @@ bool WorldObject::IsControlledByPlayer() const
case TYPEID_PLAYER: case TYPEID_PLAYER:
return ((Unit*)this)->IsCharmerOrOwnerPlayerOrPlayerItself(); return ((Unit*)this)->IsCharmerOrOwnerPlayerOrPlayerItself();
case TYPEID_DYNAMICOBJECT: case TYPEID_DYNAMICOBJECT:
return IS_PLAYER_GUID(((DynamicObject*)this)->GetCasterGUID()); return ((DynamicObject*)this)->GetCasterGuid().IsPlayer();
case TYPEID_CORPSE: case TYPEID_CORPSE:
return true; return true;
default: default:

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "10749" #define REVISION_NR "10750"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__