[9618] More use ObjectGuid in spell/etc code

This commit is contained in:
VladimirMangos 2010-03-25 11:55:30 +03:00
parent 21ff192866
commit b658b25ff8
19 changed files with 117 additions and 122 deletions

View file

@ -78,20 +78,15 @@ void GameObject::RemoveFromWorld()
if(IsInWorld())
{
// Remove GO from owner
if(uint64 owner_guid = GetOwnerGUID())
ObjectGuid owner_guid = GetOwnerGUID();
if (!owner_guid.IsEmpty())
{
if (Unit* owner = ObjectAccessor::GetUnit(*this,owner_guid))
owner->RemoveGameObject(this,false);
else
{
const char * ownerType = "creature";
if(IS_PLAYER_GUID(owner_guid))
ownerType = "player";
else if(IS_PET_GUID(owner_guid))
ownerType = "pet";
sLog.outError("Delete GameObject (GUID: %u Entry: %u SpellId %u LinkedGO %u) that lost references to owner (GUID %u Type '%s') GO list. Crash possible later.",
GetGUIDLow(), GetGOInfo()->id, m_spellId, GetGOInfo()->GetLinkedGameObjectEntry(), GUID_LOPART(owner_guid), ownerType);
sLog.outError("Delete %s with SpellId %u LinkedGO %u that lost references to owner %s GO list. Crash possible later.",
GetObjectGuid().GetString().c_str(), m_spellId, GetGOInfo()->GetLinkedGameObjectEntry(), owner_guid.GetString().c_str());
}
}
@ -164,7 +159,7 @@ bool GameObject::Create(uint32 guidlow, uint32 name_id, Map *map, uint32 phaseMa
void GameObject::Update(uint32 /*p_time*/)
{
if (IS_MO_TRANSPORT(GetGUID()))
if (GetObjectGuid().IsMOTransport())
{
//((Transport*)this)->Update(p_time);
return;
@ -1062,7 +1057,7 @@ void GameObject::Use(Unit* user)
break;
}
player->CastedCreatureOrGO(info->id, GetGUID(), 0);
player->CastedCreatureOrGO(info->id, GetObjectGuid(), 0);
}
if (uint32 trapEntry = info->goober.linkedTrapId)