*Prevent overriding owners for gameobject.

--HG--
branch : trunk
This commit is contained in:
QAston
2009-07-10 15:28:10 +02:00
parent 73fb97adb0
commit 83f74b5e46
+8
View File
@@ -501,6 +501,14 @@ class TRINITY_DLL_SPEC GameObject : public WorldObject
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
SetUInt64Value(OBJECT_FIELD_CREATED_BY, owner);
}