mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-02-25 04:55:54 +00:00
refactor(Core): Make ObjectGuid const (#23170)
* cherry-pick commit (a7883380ce)
Co-Authored-By: Lucas Nascimento <keader.android@gmail.com>
This commit is contained in:
@@ -112,7 +112,7 @@ namespace PlayerNameMapHolder
|
||||
|
||||
} // namespace PlayerNameMapHolder
|
||||
|
||||
WorldObject* ObjectAccessor::GetWorldObject(WorldObject const& p, ObjectGuid const guid)
|
||||
WorldObject* ObjectAccessor::GetWorldObject(WorldObject const& p, ObjectGuid const& guid)
|
||||
{
|
||||
switch (guid.GetHigh())
|
||||
{
|
||||
@@ -138,7 +138,7 @@ WorldObject* ObjectAccessor::GetWorldObject(WorldObject const& p, ObjectGuid con
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Object* ObjectAccessor::GetObjectByTypeMask(WorldObject const& p, ObjectGuid const guid, uint32 typemask)
|
||||
Object* ObjectAccessor::GetObjectByTypeMask(WorldObject const& p, ObjectGuid const& guid, uint32 typemask)
|
||||
{
|
||||
switch (guid.GetHigh())
|
||||
{
|
||||
@@ -176,27 +176,27 @@ Object* ObjectAccessor::GetObjectByTypeMask(WorldObject const& p, ObjectGuid con
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Corpse* ObjectAccessor::GetCorpse(WorldObject const& u, ObjectGuid const guid)
|
||||
Corpse* ObjectAccessor::GetCorpse(WorldObject const& u, ObjectGuid const& guid)
|
||||
{
|
||||
return u.GetMap()->GetCorpse(guid);
|
||||
}
|
||||
|
||||
GameObject* ObjectAccessor::GetGameObject(WorldObject const& u, ObjectGuid const guid)
|
||||
GameObject* ObjectAccessor::GetGameObject(WorldObject const& u, ObjectGuid const& guid)
|
||||
{
|
||||
return u.GetMap()->GetGameObject(guid);
|
||||
}
|
||||
|
||||
Transport* ObjectAccessor::GetTransport(WorldObject const& u, ObjectGuid const guid)
|
||||
Transport* ObjectAccessor::GetTransport(WorldObject const& u, ObjectGuid const& guid)
|
||||
{
|
||||
return u.GetMap()->GetTransport(guid);
|
||||
}
|
||||
|
||||
DynamicObject* ObjectAccessor::GetDynamicObject(WorldObject const& u, ObjectGuid const guid)
|
||||
DynamicObject* ObjectAccessor::GetDynamicObject(WorldObject const& u, ObjectGuid const& guid)
|
||||
{
|
||||
return u.GetMap()->GetDynamicObject(guid);
|
||||
}
|
||||
|
||||
Unit* ObjectAccessor::GetUnit(WorldObject const& u, ObjectGuid const guid)
|
||||
Unit* ObjectAccessor::GetUnit(WorldObject const& u, ObjectGuid const& guid)
|
||||
{
|
||||
if (guid.IsPlayer())
|
||||
return GetPlayer(u, guid);
|
||||
@@ -207,17 +207,17 @@ Unit* ObjectAccessor::GetUnit(WorldObject const& u, ObjectGuid const guid)
|
||||
return GetCreature(u, guid);
|
||||
}
|
||||
|
||||
Creature* ObjectAccessor::GetCreature(WorldObject const& u, ObjectGuid const guid)
|
||||
Creature* ObjectAccessor::GetCreature(WorldObject const& u, ObjectGuid const& guid)
|
||||
{
|
||||
return u.GetMap()->GetCreature(guid);
|
||||
}
|
||||
|
||||
Pet* ObjectAccessor::GetPet(WorldObject const& u, ObjectGuid const guid)
|
||||
Pet* ObjectAccessor::GetPet(WorldObject const& u, ObjectGuid const& guid)
|
||||
{
|
||||
return u.GetMap()->GetPet(guid);
|
||||
}
|
||||
|
||||
Player* ObjectAccessor::GetPlayer(Map const* m, ObjectGuid const guid)
|
||||
Player* ObjectAccessor::GetPlayer(Map const* m, ObjectGuid const& guid)
|
||||
{
|
||||
if (Player * player = HashMapHolder<Player>::Find(guid))
|
||||
if (player->IsInWorld() && player->GetMap() == m)
|
||||
@@ -226,12 +226,12 @@ Player* ObjectAccessor::GetPlayer(Map const* m, ObjectGuid const guid)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Player* ObjectAccessor::GetPlayer(WorldObject const& u, ObjectGuid const guid)
|
||||
Player* ObjectAccessor::GetPlayer(WorldObject const& u, ObjectGuid const& guid)
|
||||
{
|
||||
return GetPlayer(u.GetMap(), guid);
|
||||
}
|
||||
|
||||
Creature* ObjectAccessor::GetCreatureOrPetOrVehicle(WorldObject const& u, ObjectGuid const guid)
|
||||
Creature* ObjectAccessor::GetCreatureOrPetOrVehicle(WorldObject const& u, ObjectGuid const& guid)
|
||||
{
|
||||
if (guid.IsPet())
|
||||
return GetPet(u, guid);
|
||||
|
||||
@@ -60,18 +60,18 @@ public:
|
||||
namespace ObjectAccessor
|
||||
{
|
||||
// these functions return objects only if in map of specified object
|
||||
WorldObject* GetWorldObject(WorldObject const&, ObjectGuid const guid);
|
||||
Object* GetObjectByTypeMask(WorldObject const&, ObjectGuid const guid, uint32 typemask);
|
||||
Corpse* GetCorpse(WorldObject const& u, ObjectGuid const guid);
|
||||
GameObject* GetGameObject(WorldObject const& u, ObjectGuid const guid);
|
||||
Transport* GetTransport(WorldObject const& u, ObjectGuid const guid);
|
||||
DynamicObject* GetDynamicObject(WorldObject const& u, ObjectGuid const guid);
|
||||
Unit* GetUnit(WorldObject const&, ObjectGuid const guid);
|
||||
Creature* GetCreature(WorldObject const& u, ObjectGuid const guid);
|
||||
Pet* GetPet(WorldObject const&, ObjectGuid const guid);
|
||||
Player* GetPlayer(Map const*, ObjectGuid const guid);
|
||||
Player* GetPlayer(WorldObject const&, ObjectGuid const guid);
|
||||
Creature* GetCreatureOrPetOrVehicle(WorldObject const&, ObjectGuid const);
|
||||
WorldObject* GetWorldObject(WorldObject const&, ObjectGuid const& guid);
|
||||
Object* GetObjectByTypeMask(WorldObject const&, ObjectGuid const& guid, uint32 typemask);
|
||||
Corpse* GetCorpse(WorldObject const& u, ObjectGuid const& guid);
|
||||
GameObject* GetGameObject(WorldObject const& u, ObjectGuid const& guid);
|
||||
Transport* GetTransport(WorldObject const& u, ObjectGuid const& guid);
|
||||
DynamicObject* GetDynamicObject(WorldObject const& u, ObjectGuid const& guid);
|
||||
Unit* GetUnit(WorldObject const&, ObjectGuid const& guid);
|
||||
Creature* GetCreature(WorldObject const& u, ObjectGuid const& guid);
|
||||
Pet* GetPet(WorldObject const&, ObjectGuid const& guid);
|
||||
Player* GetPlayer(Map const*, ObjectGuid const& guid);
|
||||
Player* GetPlayer(WorldObject const&, ObjectGuid const& guid);
|
||||
Creature* GetCreatureOrPetOrVehicle(WorldObject const&, ObjectGuid const&);
|
||||
|
||||
// these functions return objects if found in whole world
|
||||
// ACCESS LIKE THAT IS NOT THREAD SAFE
|
||||
|
||||
Reference in New Issue
Block a user