[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

@ -112,7 +112,7 @@ void Channel::Join(ObjectGuid p, const char *pass)
JoinNotify(p);
// if no owner first logged will become
if(!IsConstant() && m_ownerGuid.IsEmpty())
if(!IsConstant() && !m_ownerGuid)
{
SetOwner(p, (m_players.size() > 1 ? true : false));
m_players[p].SetModerator(true);
@ -632,7 +632,7 @@ void Channel::Invite(ObjectGuid p, const char *newname)
void Channel::SetOwner(ObjectGuid guid, bool exclaim)
{
if (!m_ownerGuid.IsEmpty())
if (m_ownerGuid)
{
// [] will re-add player after it possible removed
PlayerList::iterator p_itr = m_players.find(m_ownerGuid);
@ -641,7 +641,8 @@ void Channel::SetOwner(ObjectGuid guid, bool exclaim)
}
m_ownerGuid = guid;
if (!m_ownerGuid.IsEmpty())
if (m_ownerGuid)
{
uint8 oldFlag = GetPlayerFlags(m_ownerGuid);
m_players[m_ownerGuid].SetOwner(true);
@ -662,7 +663,7 @@ void Channel::SendToAll(WorldPacket *data, ObjectGuid p)
{
for(PlayerList::const_iterator i = m_players.begin(); i != m_players.end(); ++i)
if (Player *plr = sObjectMgr.GetPlayer(i->first))
if (p.IsEmpty() || !plr->GetSocial()->HasIgnore(p))
if (!p || !plr->GetSocial()->HasIgnore(p))
plr->GetSession()->SendPacket(data);
}
@ -775,7 +776,7 @@ void Channel::MakeChannelOwner(WorldPacket *data)
name = "PLAYER_NOT_FOUND";
MakeNotifyPacket(data, CHAT_CHANNEL_OWNER_NOTICE);
*data << ((IsConstant() || m_ownerGuid.IsEmpty()) ? "Nobody" : name);
*data << ((IsConstant() || !m_ownerGuid) ? "Nobody" : name);
}
// done 0x0C