*Prevent overriding owners for gameobject.
--HG-- branch : trunk
This commit is contained in:
@@ -501,6 +501,14 @@ class TRINITY_DLL_SPEC GameObject : public WorldObject
|
|||||||
|
|
||||||
void SetOwnerGUID(uint64 owner)
|
void SetOwnerGUID(uint64 owner)
|
||||||
{
|
{
|
||||||
|
// Owner already found and different than expected owner - remove object from old owner
|
||||||
|
if (owner && GetOwnerGUID() && GetOwnerGUID() != owner)
|
||||||
|
{
|
||||||
|
if (Unit* owner = GetOwner())
|
||||||
|
owner->RemoveGameObject(this, false);
|
||||||
|
else
|
||||||
|
assert(false);
|
||||||
|
}
|
||||||
m_spawnedByDefault = false; // all object with owner is despawned after delay
|
m_spawnedByDefault = false; // all object with owner is despawned after delay
|
||||||
SetUInt64Value(OBJECT_FIELD_CREATED_BY, owner);
|
SetUInt64Value(OBJECT_FIELD_CREATED_BY, owner);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user