mirror of
https://github.com/mangosfour/server.git
synced 2025-12-16 04:37:00 +00:00
[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:
parent
ecdb435b1e
commit
249fb836ca
47 changed files with 194 additions and 210 deletions
|
|
@ -50,10 +50,10 @@ ObjectAccessor::~ObjectAccessor()
|
|||
Unit*
|
||||
ObjectAccessor::GetUnit(WorldObject const &u, ObjectGuid guid)
|
||||
{
|
||||
if(guid.IsEmpty())
|
||||
if (!guid)
|
||||
return NULL;
|
||||
|
||||
if(guid.IsPlayer())
|
||||
if (guid.IsPlayer())
|
||||
return FindPlayer(guid);
|
||||
|
||||
if (!u.IsInWorld())
|
||||
|
|
@ -65,9 +65,9 @@ ObjectAccessor::GetUnit(WorldObject const &u, ObjectGuid guid)
|
|||
Corpse* ObjectAccessor::GetCorpseInMap(ObjectGuid guid, uint32 mapid)
|
||||
{
|
||||
Corpse * ret = HashMapHolder<Corpse>::Find(guid);
|
||||
if(!ret)
|
||||
if (!ret)
|
||||
return NULL;
|
||||
if(ret->GetMapId() != mapid)
|
||||
if (ret->GetMapId() != mapid)
|
||||
return NULL;
|
||||
|
||||
return ret;
|
||||
|
|
@ -76,11 +76,11 @@ Corpse* ObjectAccessor::GetCorpseInMap(ObjectGuid guid, uint32 mapid)
|
|||
Player*
|
||||
ObjectAccessor::FindPlayer(ObjectGuid guid)
|
||||
{
|
||||
if (guid.IsEmpty())
|
||||
if (!guid)
|
||||
return NULL;
|
||||
|
||||
Player * plr = HashMapHolder<Player>::Find(guid);;
|
||||
if(!plr || !plr->IsInWorld())
|
||||
if (!plr || !plr->IsInWorld())
|
||||
return NULL;
|
||||
|
||||
return plr;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue