aboutsummaryrefslogtreecommitdiff
path: root/src/game/GameObject.cpp
diff options
context:
space:
mode:
authorQAston <none@none>2009-08-01 20:23:23 +0200
committerQAston <none@none>2009-08-01 20:23:23 +0200
commitaa60def6acd9b15267cf3c95f9a7e65531838796 (patch)
tree1152d6944696f0a88c2008413281b0ed5c6bff95 /src/game/GameObject.cpp
parentd577d00313c673b51e79181ed8a5eb3146aded9e (diff)
*Teleport player to homebind if instance can't be created in WorldSession::HandleMoveWorldportAckOpcode.
--HG-- branch : trunk
Diffstat (limited to 'src/game/GameObject.cpp')
-rw-r--r--src/game/GameObject.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/game/GameObject.cpp b/src/game/GameObject.cpp
index e6ff16f251c..f934d3d1fe7 100644
--- a/src/game/GameObject.cpp
+++ b/src/game/GameObject.cpp
@@ -123,8 +123,7 @@ void GameObject::RemoveFromWorld()
// Possible crash at access to deleted GO in Unit::m_gameobj
if(uint64 owner_guid = GetOwnerGUID())
{
- Unit* owner = ObjectAccessor::GetUnit(*this,owner_guid);
- if(owner)
+ if(Unit * owner = GetOwner(false))
owner->RemoveGameObject(this,false);
else if(!IS_PLAYER_GUID(owner_guid))
sLog.outError("Delete GameObject (GUID: %u Entry: %u ) that have references in not found creature %u GO list. Crash possible later.",GetGUIDLow(),GetGOInfo()->id,GUID_LOPART(owner_guid));
@@ -707,9 +706,11 @@ bool GameObject::IsTransport() const
return gInfo->type == GAMEOBJECT_TYPE_TRANSPORT || gInfo->type == GAMEOBJECT_TYPE_MO_TRANSPORT;
}
-Unit* GameObject::GetOwner() const
+Unit* GameObject::GetOwner(bool inWorld) const
{
- return ObjectAccessor::GetUnit(*this, GetOwnerGUID());
+ if (inWorld)
+ return ObjectAccessor::GetUnit(*this, GetOwnerGUID());
+ return ObjectAccessor::GetUnitInOrOutOfWorld(*this, GetOwnerGUID());
}
void GameObject::SaveRespawnTime()