[11490] Alow implicit cast ObjectGuid->uint64 and only explicit uint64->ObjectGuid

Now safe allow this casts in like way after completed convertion to ObjectGuid use.
Also simplify code in result allowed auto cast to uint64.

Please _not_ add new uint64 storages (local and in structures) for guid values.
This commit is contained in:
VladimirMangos 2011-05-15 22:01:16 +04:00
parent ecdb435b1e
commit 249fb836ca
47 changed files with 194 additions and 210 deletions

View file

@ -79,8 +79,7 @@ void GameObject::RemoveFromWorld()
if(IsInWorld())
{
// Remove GO from owner
ObjectGuid owner_guid = GetOwnerGuid();
if (!owner_guid.IsEmpty())
if (ObjectGuid owner_guid = GetOwnerGuid())
{
if (Unit* owner = ObjectAccessor::GetUnit(*this,owner_guid))
owner->RemoveGameObject(this,false);
@ -391,7 +390,7 @@ void GameObject::Update(uint32 update_diff, uint32 /*p_time*/)
//any return here in case battleground traps
}
if (!GetOwnerGuid().IsEmpty())
if (GetOwnerGuid())
{
if (Unit* owner = GetOwner())
owner->RemoveGameObject(this, false);
@ -449,7 +448,7 @@ void GameObject::AddUniqueUse(Player* player)
{
AddUse();
if (m_firstUser.IsEmpty())
if (!m_firstUser)
m_firstUser = player->GetObjectGuid();
m_UniqueUsers.insert(player->GetObjectGuid());
@ -833,7 +832,7 @@ void GameObject::SummonLinkedTrapIfAny()
linkedGO->SetRespawnTime(GetRespawnDelay());
linkedGO->SetSpellId(GetSpellId());
if (!GetOwnerGuid().IsEmpty())
if (GetOwnerGuid())
{
linkedGO->SetOwnerGuid(GetOwnerGuid());
linkedGO->SetUInt32Value(GAMEOBJECT_LEVEL, GetUInt32Value(GAMEOBJECT_LEVEL));
@ -1309,7 +1308,7 @@ void GameObject::Use(Unit* user)
}
else
{
if (!m_firstUser.IsEmpty() && player->GetObjectGuid() != m_firstUser && info->summoningRitual.castersGrouped)
if (m_firstUser && player->GetObjectGuid() != m_firstUser && info->summoningRitual.castersGrouped)
{
if (Group* group = player->GetGroup())
{
@ -1338,7 +1337,7 @@ void GameObject::Use(Unit* user)
return;
// owner is first user for non-wild GO objects, if it offline value already set to current user
if (GetOwnerGuid().IsEmpty())
if (!GetOwnerGuid())
if (Player* firstUser = GetMap()->GetPlayer(m_firstUser))
spellCaster = firstUser;