mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-18 19:35:42 +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:
@@ -46,7 +46,7 @@ public:
|
||||
|
||||
// Pass parameters between AI
|
||||
virtual void DoAction(int32 /*param = 0 */) {}
|
||||
virtual void SetGUID(ObjectGuid /*guid*/, int32 /*id = 0 */) {}
|
||||
virtual void SetGUID(ObjectGuid const& /*guid*/, int32 /*id = 0 */) {}
|
||||
virtual ObjectGuid GetGUID(int32 /*id = 0 */) const { return ObjectGuid::Empty; }
|
||||
|
||||
static int32 Permissible(GameObject const* go);
|
||||
|
||||
@@ -217,7 +217,7 @@ public:
|
||||
virtual void DoAction(int32 /*param*/) {}
|
||||
virtual uint32 GetData(uint32 /*id = 0*/) const { return 0; }
|
||||
virtual void SetData(uint32 /*id*/, uint32 /*value*/) {}
|
||||
virtual void SetGUID(ObjectGuid /*guid*/, int32 /*id*/ = 0) {}
|
||||
virtual void SetGUID(ObjectGuid const& /*guid*/, int32 /*id*/ = 0) {}
|
||||
virtual ObjectGuid GetGUID(int32 /*id*/ = 0) const { return ObjectGuid::Empty; }
|
||||
|
||||
// Select the best target (in <targetType> order) from the threat list that fulfill the following:
|
||||
|
||||
@@ -42,7 +42,7 @@ void AddGossipItemFor(Player* player, uint32 gossipMenuID, uint32 gossipMenuItem
|
||||
player->PlayerTalkClass->GetGossipMenu().AddMenuItem(gossipMenuID, gossipMenuItemID, sender, action, boxMoney);
|
||||
}
|
||||
|
||||
void SendGossipMenuFor(Player* player, uint32 npcTextID, ObjectGuid const guid)
|
||||
void SendGossipMenuFor(Player* player, uint32 npcTextID, ObjectGuid const& guid)
|
||||
{
|
||||
player->PlayerTalkClass->SendGossipMenu(npcTextID, guid);
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ void AddGossipItemFor(Player* player, uint32 icon, std::string const& text, uint
|
||||
void AddGossipItemFor(Player* player, uint32 gossipMenuID, uint32 gossipMenuItemID, uint32 sender, uint32 action, uint32 boxMoney = 0);
|
||||
|
||||
// Send menu text
|
||||
void SendGossipMenuFor(Player* player, uint32 npcTextID, ObjectGuid const guid);
|
||||
void SendGossipMenuFor(Player* player, uint32 npcTextID, ObjectGuid const& guid);
|
||||
void SendGossipMenuFor(Player* player, uint32 npcTextID, Creature const* creature);
|
||||
|
||||
// Close menu
|
||||
|
||||
@@ -993,7 +993,7 @@ void SmartAI::SetData(uint32 id, uint32 value, WorldObject* invoker)
|
||||
GetScript()->ProcessEventsFor(SMART_EVENT_DATA_SET, unit, id, value, false, nullptr, gob);
|
||||
}
|
||||
|
||||
void SmartAI::SetGUID(ObjectGuid /*guid*/, int32 /*id*/)
|
||||
void SmartAI::SetGUID(ObjectGuid const& /*guid*/, int32 /*id*/)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -164,7 +164,7 @@ public:
|
||||
void SetData(uint32 id, uint32 value, WorldObject* invoker);
|
||||
|
||||
// Used in scripts to share variables
|
||||
void SetGUID(ObjectGuid guid, int32 id = 0) override;
|
||||
void SetGUID(ObjectGuid const& guid, int32 id = 0) override;
|
||||
|
||||
// Used in scripts to share variables
|
||||
ObjectGuid GetGUID(int32 id = 0) const override;
|
||||
|
||||
@@ -855,7 +855,7 @@ GameObject* Battlefield::SpawnGameObject(uint32 entry, float x, float y, float z
|
||||
return go;
|
||||
}
|
||||
|
||||
Creature* Battlefield::GetCreature(ObjectGuid const guid)
|
||||
Creature* Battlefield::GetCreature(ObjectGuid const& guid)
|
||||
{
|
||||
if (!m_Map)
|
||||
return nullptr;
|
||||
@@ -863,7 +863,7 @@ Creature* Battlefield::GetCreature(ObjectGuid const guid)
|
||||
return m_Map->GetCreature(guid);
|
||||
}
|
||||
|
||||
GameObject* Battlefield::GetGameObject(ObjectGuid const guid)
|
||||
GameObject* Battlefield::GetGameObject(ObjectGuid const& guid)
|
||||
{
|
||||
if (!m_Map)
|
||||
return nullptr;
|
||||
|
||||
@@ -303,8 +303,8 @@ public:
|
||||
Creature* SpawnCreature(uint32 entry, Position pos, TeamId teamId);
|
||||
GameObject* SpawnGameObject(uint32 entry, float x, float y, float z, float o);
|
||||
|
||||
Creature* GetCreature(ObjectGuid const guid);
|
||||
GameObject* GetGameObject(ObjectGuid const guid);
|
||||
Creature* GetCreature(ObjectGuid const& guid);
|
||||
GameObject* GetGameObject(ObjectGuid const& guid);
|
||||
|
||||
// Script-methods
|
||||
|
||||
|
||||
@@ -121,7 +121,7 @@ void Corpse::DeleteFromDB(CharacterDatabaseTransaction trans)
|
||||
DeleteFromDB(GetOwnerGUID(), trans);
|
||||
}
|
||||
|
||||
void Corpse::DeleteFromDB(ObjectGuid const ownerGuid, CharacterDatabaseTransaction trans)
|
||||
void Corpse::DeleteFromDB(ObjectGuid const& ownerGuid, CharacterDatabaseTransaction trans)
|
||||
{
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CORPSE);
|
||||
stmt->SetData(0, ownerGuid.GetCounter());
|
||||
|
||||
@@ -63,7 +63,7 @@ public:
|
||||
bool LoadCorpseFromDB(ObjectGuid::LowType guid, Field* fields);
|
||||
|
||||
void DeleteFromDB(CharacterDatabaseTransaction trans);
|
||||
static void DeleteFromDB(ObjectGuid const ownerGuid, CharacterDatabaseTransaction trans);
|
||||
static void DeleteFromDB(ObjectGuid const& ownerGuid, CharacterDatabaseTransaction trans);
|
||||
|
||||
[[nodiscard]] ObjectGuid GetOwnerGUID() const { return GetGuidValue(CORPSE_FIELD_OWNER); }
|
||||
|
||||
|
||||
@@ -3051,13 +3051,13 @@ SpellInfo const* GameObject::GetSpellForLock(Player const* player) const
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void GameObject::AddToSkillupList(ObjectGuid playerGuid)
|
||||
void GameObject::AddToSkillupList(ObjectGuid const& playerGuid)
|
||||
{
|
||||
int32 timer = GetMap()->IsDungeon() ? -1 : 10 * MINUTE * IN_MILLISECONDS;
|
||||
m_SkillupList[playerGuid] = timer;
|
||||
}
|
||||
|
||||
bool GameObject::IsInSkillupList(ObjectGuid playerGuid) const
|
||||
bool GameObject::IsInSkillupList(ObjectGuid const& playerGuid) const
|
||||
{
|
||||
for (auto const& itr : m_SkillupList)
|
||||
{
|
||||
|
||||
@@ -231,8 +231,8 @@ public:
|
||||
void RemoveLootMode(uint16 lootMode) { m_LootMode &= ~lootMode; }
|
||||
void ResetLootMode() { m_LootMode = LOOT_MODE_DEFAULT; }
|
||||
|
||||
void AddToSkillupList(ObjectGuid playerGuid);
|
||||
[[nodiscard]] bool IsInSkillupList(ObjectGuid playerGuid) const;
|
||||
void AddToSkillupList(ObjectGuid const& playerGuid);
|
||||
[[nodiscard]] bool IsInSkillupList(ObjectGuid const& playerGuid) const;
|
||||
|
||||
void AddUniqueUse(Player* player);
|
||||
void AddUse() { ++m_usetimes; }
|
||||
|
||||
@@ -269,7 +269,7 @@ class PackedGuid
|
||||
explicit PackedGuid(ObjectGuid guid) : _packedGuid(PACKED_GUID_MIN_BUFFER_SIZE) { _packedGuid.appendPackGUID(guid.GetRawValue()); }
|
||||
|
||||
void Set(uint64 guid) { _packedGuid.wpos(0); _packedGuid.appendPackGUID(guid); }
|
||||
void Set(ObjectGuid guid) { _packedGuid.wpos(0); _packedGuid.appendPackGUID(guid.GetRawValue()); }
|
||||
void Set(ObjectGuid const& guid) { _packedGuid.wpos(0); _packedGuid.appendPackGUID(guid.GetRawValue()); }
|
||||
|
||||
[[nodiscard]] std::size_t size() const { return _packedGuid.size(); }
|
||||
|
||||
|
||||
@@ -2088,7 +2088,7 @@ bool Player::CanInteractWithQuestGiver(Object* questGiver)
|
||||
return false;
|
||||
}
|
||||
|
||||
Creature* Player::GetNPCIfCanInteractWith(ObjectGuid guid, uint32 npcflagmask)
|
||||
Creature* Player::GetNPCIfCanInteractWith(ObjectGuid const& guid, uint32 npcflagmask)
|
||||
{
|
||||
// unit checks
|
||||
if (!guid)
|
||||
@@ -2145,7 +2145,7 @@ Creature* Player::GetNPCIfCanInteractWith(ObjectGuid guid, uint32 npcflagmask)
|
||||
return creature;
|
||||
}
|
||||
|
||||
GameObject* Player::GetGameObjectIfCanInteractWith(ObjectGuid guid, GameobjectTypes type) const
|
||||
GameObject* Player::GetGameObjectIfCanInteractWith(ObjectGuid const& guid, GameobjectTypes type) const
|
||||
{
|
||||
if (GameObject* go = GetMap()->GetGameObject(guid))
|
||||
{
|
||||
@@ -4616,7 +4616,7 @@ void Player::KillPlayer()
|
||||
//UpdateObjectVisibility(); // pussywizard: not needed
|
||||
}
|
||||
|
||||
void Player::OfflineResurrect(ObjectGuid const guid, CharacterDatabaseTransaction trans)
|
||||
void Player::OfflineResurrect(ObjectGuid const& guid, CharacterDatabaseTransaction trans)
|
||||
{
|
||||
Corpse::DeleteFromDB(guid, trans);
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG);
|
||||
|
||||
@@ -1128,8 +1128,8 @@ public:
|
||||
void SendInstanceResetWarning(uint32 mapid, Difficulty difficulty, uint32 time, bool onEnterMap);
|
||||
|
||||
bool CanInteractWithQuestGiver(Object* questGiver);
|
||||
Creature* GetNPCIfCanInteractWith(ObjectGuid guid, uint32 npcflagmask);
|
||||
[[nodiscard]] GameObject* GetGameObjectIfCanInteractWith(ObjectGuid guid, GameobjectTypes type) const;
|
||||
Creature* GetNPCIfCanInteractWith(ObjectGuid const& guid, uint32 npcflagmask);
|
||||
[[nodiscard]] GameObject* GetGameObjectIfCanInteractWith(ObjectGuid const& guid, GameobjectTypes type) const;
|
||||
|
||||
void ToggleAFK();
|
||||
void ToggleDND();
|
||||
@@ -2033,7 +2033,7 @@ public:
|
||||
Corpse* CreateCorpse();
|
||||
void RemoveCorpse();
|
||||
void KillPlayer();
|
||||
static void OfflineResurrect(ObjectGuid const guid, CharacterDatabaseTransaction trans);
|
||||
static void OfflineResurrect(ObjectGuid const& guid, CharacterDatabaseTransaction trans);
|
||||
[[nodiscard]] bool HasCorpse() const { return _corpseLocation.GetMapId() != MAPID_INVALID; }
|
||||
[[nodiscard]] WorldLocation GetCorpseLocation() const { return _corpseLocation; }
|
||||
uint32 GetResurrectionSpellId();
|
||||
|
||||
@@ -37,7 +37,7 @@ uint32 PlayerSocial::GetNumberOfSocialsWithFlag(SocialFlag flag) const
|
||||
return counter;
|
||||
}
|
||||
|
||||
bool PlayerSocial::AddToSocialList(ObjectGuid friendGuid, SocialFlag flag)
|
||||
bool PlayerSocial::AddToSocialList(ObjectGuid const& friendGuid, SocialFlag flag)
|
||||
{
|
||||
// check client limits
|
||||
if (GetNumberOfSocialsWithFlag(flag) >= (((flag & SOCIAL_FLAG_FRIEND) != 0) ? SOCIALMGR_FRIEND_LIMIT : SOCIALMGR_IGNORE_LIMIT))
|
||||
@@ -71,7 +71,7 @@ bool PlayerSocial::AddToSocialList(ObjectGuid friendGuid, SocialFlag flag)
|
||||
return true;
|
||||
}
|
||||
|
||||
void PlayerSocial::RemoveFromSocialList(ObjectGuid friendGuid, SocialFlag flag)
|
||||
void PlayerSocial::RemoveFromSocialList(ObjectGuid const& friendGuid, SocialFlag flag)
|
||||
{
|
||||
auto itr = m_playerSocialMap.find(friendGuid);
|
||||
if (itr == m_playerSocialMap.end()) // not exist
|
||||
@@ -102,7 +102,7 @@ void PlayerSocial::RemoveFromSocialList(ObjectGuid friendGuid, SocialFlag flag)
|
||||
}
|
||||
}
|
||||
|
||||
void PlayerSocial::SetFriendNote(ObjectGuid friendGuid, std::string note)
|
||||
void PlayerSocial::SetFriendNote(ObjectGuid const& friendGuid, std::string note)
|
||||
{
|
||||
auto itr = m_playerSocialMap.find(friendGuid);
|
||||
if (itr == m_playerSocialMap.end()) // not exist
|
||||
@@ -176,7 +176,7 @@ void PlayerSocial::SendSocialList(Player* player, uint32 flags)
|
||||
LOG_DEBUG("network", "WORLD: Sent SMSG_CONTACT_LIST");
|
||||
}
|
||||
|
||||
bool PlayerSocial::_checkContact(ObjectGuid guid, SocialFlag flags) const
|
||||
bool PlayerSocial::_checkContact(ObjectGuid const& guid, SocialFlag flags) const
|
||||
{
|
||||
auto const& itr = m_playerSocialMap.find(guid);
|
||||
if (itr != m_playerSocialMap.end())
|
||||
@@ -185,12 +185,12 @@ bool PlayerSocial::_checkContact(ObjectGuid guid, SocialFlag flags) const
|
||||
return false;
|
||||
}
|
||||
|
||||
bool PlayerSocial::HasFriend(ObjectGuid friend_guid) const
|
||||
bool PlayerSocial::HasFriend(ObjectGuid const& friend_guid) const
|
||||
{
|
||||
return _checkContact(friend_guid, SOCIAL_FLAG_FRIEND);
|
||||
}
|
||||
|
||||
bool PlayerSocial::HasIgnore(ObjectGuid ignore_guid) const
|
||||
bool PlayerSocial::HasIgnore(ObjectGuid const& ignore_guid) const
|
||||
{
|
||||
return _checkContact(ignore_guid, SOCIAL_FLAG_IGNORED);
|
||||
}
|
||||
@@ -209,7 +209,7 @@ SocialMgr* SocialMgr::instance()
|
||||
return &instance;
|
||||
}
|
||||
|
||||
void SocialMgr::GetFriendInfo(Player* player, ObjectGuid friendGUID, FriendInfo& friendInfo)
|
||||
void SocialMgr::GetFriendInfo(Player* player, ObjectGuid const& friendGUID, FriendInfo& friendInfo)
|
||||
{
|
||||
if (!player)
|
||||
return;
|
||||
@@ -247,14 +247,14 @@ void SocialMgr::GetFriendInfo(Player* player, ObjectGuid friendGUID, FriendInfo&
|
||||
}
|
||||
}
|
||||
|
||||
void SocialMgr::MakeFriendStatusPacket(FriendsResult result, ObjectGuid guid, WorldPacket* data)
|
||||
void SocialMgr::MakeFriendStatusPacket(FriendsResult result, ObjectGuid const& guid, WorldPacket* data)
|
||||
{
|
||||
data->Initialize(SMSG_FRIEND_STATUS, 9);
|
||||
*data << uint8(result);
|
||||
*data << guid;
|
||||
}
|
||||
|
||||
void SocialMgr::SendFriendStatus(Player* player, FriendsResult result, ObjectGuid friendGuid, bool broadcast)
|
||||
void SocialMgr::SendFriendStatus(Player* player, FriendsResult result, ObjectGuid const& friendGuid, bool broadcast)
|
||||
{
|
||||
FriendInfo fi;
|
||||
GetFriendInfo(player, friendGuid, fi);
|
||||
@@ -316,7 +316,7 @@ void SocialMgr::BroadcastToFriendListers(Player* player, WorldPacket* packet)
|
||||
}
|
||||
}
|
||||
|
||||
PlayerSocial* SocialMgr::LoadFromDB(PreparedQueryResult result, ObjectGuid guid)
|
||||
PlayerSocial* SocialMgr::LoadFromDB(PreparedQueryResult result, ObjectGuid const& guid)
|
||||
{
|
||||
PlayerSocial* social = &m_socialMap[guid];
|
||||
social->SetPlayerGUID(guid);
|
||||
|
||||
@@ -104,19 +104,19 @@ class PlayerSocial
|
||||
public:
|
||||
PlayerSocial();
|
||||
// adding/removing
|
||||
bool AddToSocialList(ObjectGuid friend_guid, SocialFlag flag);
|
||||
void RemoveFromSocialList(ObjectGuid friend_guid, SocialFlag flag);
|
||||
void SetFriendNote(ObjectGuid friendGuid, std::string note);
|
||||
bool AddToSocialList(ObjectGuid const& friend_guid, SocialFlag flag);
|
||||
void RemoveFromSocialList(ObjectGuid const& friend_guid, SocialFlag flag);
|
||||
void SetFriendNote(ObjectGuid const& friendGuid, std::string note);
|
||||
// Packet send's
|
||||
void SendSocialList(Player* player, uint32 flags);
|
||||
// Misc
|
||||
bool HasFriend(ObjectGuid friend_guid) const;
|
||||
bool HasIgnore(ObjectGuid ignore_guid) const;
|
||||
ObjectGuid GetPlayerGUID() const { return m_playerGUID; }
|
||||
void SetPlayerGUID(ObjectGuid guid) { m_playerGUID = guid; }
|
||||
bool HasFriend(ObjectGuid const& friend_guid) const;
|
||||
bool HasIgnore(ObjectGuid const& ignore_guid) const;
|
||||
ObjectGuid const& GetPlayerGUID() const { return m_playerGUID; }
|
||||
void SetPlayerGUID(ObjectGuid const& guid) { m_playerGUID = guid; }
|
||||
uint32 GetNumberOfSocialsWithFlag(SocialFlag flag) const;
|
||||
private:
|
||||
bool _checkContact(ObjectGuid guid, SocialFlag flags) const;
|
||||
bool _checkContact(ObjectGuid const& guid, SocialFlag flags) const;
|
||||
typedef std::map<ObjectGuid, FriendInfo> PlayerSocialMap;
|
||||
PlayerSocialMap m_playerSocialMap;
|
||||
ObjectGuid m_playerGUID;
|
||||
@@ -131,14 +131,14 @@ class SocialMgr
|
||||
public:
|
||||
static SocialMgr* instance();
|
||||
// Misc
|
||||
void RemovePlayerSocial(ObjectGuid guid) { m_socialMap.erase(guid); }
|
||||
static void GetFriendInfo(Player* player, ObjectGuid friendGUID, FriendInfo& friendInfo);
|
||||
void RemovePlayerSocial(ObjectGuid const& guid) { m_socialMap.erase(guid); }
|
||||
static void GetFriendInfo(Player* player, ObjectGuid const& friendGUID, FriendInfo& friendInfo);
|
||||
// Packet management
|
||||
void MakeFriendStatusPacket(FriendsResult result, ObjectGuid friend_guid, WorldPacket* data);
|
||||
void SendFriendStatus(Player* player, FriendsResult result, ObjectGuid friend_guid, bool broadcast);
|
||||
void MakeFriendStatusPacket(FriendsResult result, ObjectGuid const& friend_guid, WorldPacket* data);
|
||||
void SendFriendStatus(Player* player, FriendsResult result, ObjectGuid const& friend_guid, bool broadcast);
|
||||
void BroadcastToFriendListers(Player* player, WorldPacket* packet);
|
||||
// Loading
|
||||
PlayerSocial* LoadFromDB(PreparedQueryResult result, ObjectGuid guid);
|
||||
PlayerSocial* LoadFromDB(PreparedQueryResult result, ObjectGuid const& guid);
|
||||
private:
|
||||
typedef std::map<ObjectGuid, PlayerSocial> SocialMap;
|
||||
SocialMap m_socialMap;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -2358,27 +2358,27 @@ void BattlegroundMap::RemoveAllPlayers()
|
||||
player->TeleportTo(player->GetEntryPoint());
|
||||
}
|
||||
|
||||
Corpse* Map::GetCorpse(ObjectGuid const guid)
|
||||
Corpse* Map::GetCorpse(ObjectGuid const& guid)
|
||||
{
|
||||
return _objectsStore.Find<Corpse>(guid);
|
||||
}
|
||||
|
||||
Creature* Map::GetCreature(ObjectGuid const guid)
|
||||
Creature* Map::GetCreature(ObjectGuid const& guid)
|
||||
{
|
||||
return _objectsStore.Find<Creature>(guid);
|
||||
}
|
||||
|
||||
GameObject* Map::GetGameObject(ObjectGuid const guid)
|
||||
GameObject* Map::GetGameObject(ObjectGuid const& guid)
|
||||
{
|
||||
return _objectsStore.Find<GameObject>(guid);
|
||||
}
|
||||
|
||||
Pet* Map::GetPet(ObjectGuid const guid)
|
||||
Pet* Map::GetPet(ObjectGuid const& guid)
|
||||
{
|
||||
return dynamic_cast<Pet*>(_objectsStore.Find<Creature>(guid));
|
||||
}
|
||||
|
||||
Transport* Map::GetTransport(ObjectGuid guid)
|
||||
Transport* Map::GetTransport(ObjectGuid const& guid)
|
||||
{
|
||||
if (guid.GetHigh() != HighGuid::Mo_Transport && guid.GetHigh() != HighGuid::Transport)
|
||||
return nullptr;
|
||||
@@ -2387,7 +2387,7 @@ Transport* Map::GetTransport(ObjectGuid guid)
|
||||
return go ? go->ToTransport() : nullptr;
|
||||
}
|
||||
|
||||
DynamicObject* Map::GetDynamicObject(ObjectGuid guid)
|
||||
DynamicObject* Map::GetDynamicObject(ObjectGuid const& guid)
|
||||
{
|
||||
return _objectsStore.Find<DynamicObject>(guid);
|
||||
}
|
||||
@@ -2679,7 +2679,7 @@ void Map::RemoveCorpse(Corpse* corpse)
|
||||
_corpseBones.erase(corpse);
|
||||
}
|
||||
|
||||
Corpse* Map::ConvertCorpseToBones(ObjectGuid const ownerGuid, bool insignia /*= false*/)
|
||||
Corpse* Map::ConvertCorpseToBones(ObjectGuid const& ownerGuid, bool insignia /*= false*/)
|
||||
{
|
||||
Corpse* corpse = GetCorpseByPlayer(ownerGuid);
|
||||
if (!corpse)
|
||||
|
||||
@@ -338,12 +338,12 @@ public:
|
||||
GameObject* SummonGameObject(uint32 entry, Position const& pos, float rotation0 = 0.0f, float rotation1 = 0.0f, float rotation2 = 0.0f, float rotation3 = 0.0f, uint32 respawnTime = 100, bool checkTransport = true);
|
||||
void SummonCreatureGroup(uint8 group, std::list<TempSummon*>* list = nullptr);
|
||||
|
||||
Corpse* GetCorpse(ObjectGuid const guid);
|
||||
Creature* GetCreature(ObjectGuid const guid);
|
||||
GameObject* GetGameObject(ObjectGuid const guid);
|
||||
Transport* GetTransport(ObjectGuid const guid);
|
||||
DynamicObject* GetDynamicObject(ObjectGuid const guid);
|
||||
Pet* GetPet(ObjectGuid const guid);
|
||||
Corpse* GetCorpse(ObjectGuid const& guid);
|
||||
Creature* GetCreature(ObjectGuid const& guid);
|
||||
GameObject* GetGameObject(ObjectGuid const& guid);
|
||||
Transport* GetTransport(ObjectGuid const& guid);
|
||||
DynamicObject* GetDynamicObject(ObjectGuid const& guid);
|
||||
Pet* GetPet(ObjectGuid const& guid);
|
||||
|
||||
MapStoredObjectTypesContainer& GetObjectsStore() { return _objectsStore; }
|
||||
|
||||
@@ -438,7 +438,7 @@ public:
|
||||
void DeleteCorpseData();
|
||||
void AddCorpse(Corpse* corpse);
|
||||
void RemoveCorpse(Corpse* corpse);
|
||||
Corpse* ConvertCorpseToBones(ObjectGuid const ownerGuid, bool insignia = false);
|
||||
Corpse* ConvertCorpseToBones(ObjectGuid const& ownerGuid, bool insignia = false);
|
||||
void RemoveOldCorpses();
|
||||
|
||||
static void DeleteRespawnTimesInDB(uint16 mapId, uint32 instanceId);
|
||||
|
||||
@@ -852,7 +852,7 @@ void WorldState::HandleSunsReachSubPhaseTransition(int32 subPhaseMask, bool init
|
||||
if (!initial)
|
||||
{
|
||||
std::lock_guard<std::mutex> guard(m_sunsReachData.m_sunsReachReclamationMutex);
|
||||
for (ObjectGuid& guid : m_sunsReachData.m_sunsReachReclamationPlayers)
|
||||
for (ObjectGuid const& guid : m_sunsReachData.m_sunsReachReclamationPlayers)
|
||||
if (Player* player = ObjectAccessor::FindPlayer(guid))
|
||||
{
|
||||
if (start)
|
||||
|
||||
Reference in New Issue
Block a user