[10671] Convert some Unit owner/etc guids to ObjectGuid way.

This commit is contained in:
VladimirMangos 2010-11-01 12:11:23 +03:00
parent 92d98b9fb2
commit a32d68febd
18 changed files with 154 additions and 149 deletions

View file

@ -1464,7 +1464,7 @@ void Player::Update( uint32 p_time )
SendUpdateToOutOfRangeGroupMembers();
Pet* pet = GetPet();
if(pet && !pet->IsWithinDistInMap(this, GetMap()->GetVisibilityDistance()) && (GetCharmGUID() && (pet->GetGUID() != GetCharmGUID())))
if (pet && !pet->IsWithinDistInMap(this, GetMap()->GetVisibilityDistance()) && (!GetCharmGuid().IsEmpty() && (pet->GetObjectGuid() != GetCharmGuid())))
{
RemovePet(pet, PET_SAVE_NOT_IN_SLOT, true);
}
@ -2261,7 +2261,7 @@ Creature* Player::GetNPCIfCanInteractWith(ObjectGuid guid, uint32 npcflagmask)
return NULL;
// not allow interaction under control, but allow with own pets
if (unit->GetCharmerGUID())
if (!unit->GetCharmerGuid().IsEmpty())
return NULL;
// not enemy
@ -6906,12 +6906,12 @@ void Player::DuelComplete(DuelCompleteType type)
// cleanup combo points
if (GetComboTargetGuid() == duel->opponent->GetObjectGuid())
ClearComboPoints();
else if (GetComboTargetGuid().GetRawValue() == duel->opponent->GetPetGUID())
else if (GetComboTargetGuid() == duel->opponent->GetPetGuid())
ClearComboPoints();
if (duel->opponent->GetComboTargetGuid() == GetObjectGuid())
duel->opponent->ClearComboPoints();
else if (duel->opponent->GetComboTargetGuid().GetRawValue() == GetPetGUID())
else if (duel->opponent->GetComboTargetGuid() == GetPetGuid())
duel->opponent->ClearComboPoints();
//cleanups
@ -15392,9 +15392,9 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
SetCharm(NULL);
SetPet(NULL);
SetTargetGuid(ObjectGuid());
SetCharmerGUID(0);
SetOwnerGUID(0);
SetCreatorGUID(0);
SetCharmerGuid(ObjectGuid());
SetOwnerGuid(ObjectGuid());
SetCreatorGuid(ObjectGuid());
// reset some aura modifiers before aura apply
@ -17738,7 +17738,7 @@ void Player::RemovePet(Pet* pet, PetSaveMode mode, bool returnreagent)
if (!pet)
pet = GetPet();
if (!pet || pet->GetOwnerGUID() != GetGUID())
if (!pet || pet->GetOwnerGuid() != GetObjectGuid())
return;
// not save secondary permanent pet as current
@ -17780,7 +17780,7 @@ void Player::RemovePet(Pet* pet, PetSaveMode mode, bool returnreagent)
RemoveGuardian(pet);
break;
default:
if (GetPetGUID() == pet->GetGUID())
if (GetPetGuid() == pet->GetObjectGuid())
SetPet(NULL);
break;
}
@ -17965,13 +17965,13 @@ void Player::PetSpellInitialize()
void Player::SendPetGUIDs()
{
if(!GetPetGUID())
if (GetPetGuid().IsEmpty())
return;
// Later this function might get modified for multiple guids
WorldPacket data(SMSG_PET_GUIDS, 12);
data << uint32(1); // count
data << uint64(GetPetGUID());
data << ObjectGuid(GetPetGuid());
GetSession()->SendPacket(&data);
}
@ -19435,7 +19435,7 @@ inline void BeforeVisibilityDestroy(T* /*t*/, Player* /*p*/)
template<>
inline void BeforeVisibilityDestroy<Creature>(Creature* t, Player* p)
{
if (p->GetPetGUID()==t->GetGUID() && ((Creature*)t)->IsPet())
if (p->GetPetGuid() == t->GetObjectGuid() && ((Creature*)t)->IsPet())
((Pet*)t)->Remove(PET_SAVE_NOT_IN_SLOT, true);
}
@ -20970,7 +20970,7 @@ void Player::EnterVehicle(Vehicle *vehicle)
if(!veSeat)
return;
vehicle->SetCharmerGUID(GetGUID());
vehicle->SetCharmerGuid(GetObjectGuid());
vehicle->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK);
vehicle->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED);
vehicle->setFaction(getFaction());
@ -21022,7 +21022,7 @@ void Player::EnterVehicle(Vehicle *vehicle)
void Player::ExitVehicle(Vehicle *vehicle)
{
vehicle->SetCharmerGUID(0);
vehicle->SetCharmerGuid(ObjectGuid());
vehicle->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK);
vehicle->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED);
vehicle->setFaction((GetTeam() == ALLIANCE) ? vehicle->GetCreatureInfo()->faction_A : vehicle->GetCreatureInfo()->faction_H);
@ -21775,14 +21775,14 @@ void Player::UnsummonPetTemporaryIfAny()
void Player::ResummonPetTemporaryUnSummonedIfAny()
{
if(!m_temporaryUnsummonedPetNumber)
if (!m_temporaryUnsummonedPetNumber)
return;
// not resummon in not appropriate state
if(IsPetNeedBeTemporaryUnsummoned())
if (IsPetNeedBeTemporaryUnsummoned())
return;
if(GetPetGUID())
if (!GetPetGuid().IsEmpty())
return;
Pet* NewPet = new Pet;