Core/Player: Optimize Player::HaveAtClient() performance
Change m_clientGUIDs from std::set to std::unordered_set to reduce by 2.7x times the cpu usage in Player::HaveAtClient()
This commit is contained in:
1 parent
46863b3afa
commit
49ececf038
6 files changed
+12
-10
No files matched your search
@@ -22560,13 +22560,13 @@ bool Player::IsVisibleGloballyFor(Player const* u) const
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline void UpdateVisibilityOf_helper(GuidSet& s64, T* target, std::set<Unit*>& /*v*/)
|
||||
inline void UpdateVisibilityOf_helper(GuidUnorderedSet& s64, T* target, std::set<Unit*>& /*v*/)
|
||||
{
|
||||
s64.insert(target->GetGUID());
|
||||
}
|
||||
|
||||
template<>
|
||||
inline void UpdateVisibilityOf_helper(GuidSet& s64, GameObject* target, std::set<Unit*>& /*v*/)
|
||||
inline void UpdateVisibilityOf_helper(GuidUnorderedSet& s64, GameObject* target, std::set<Unit*>& /*v*/)
|
||||
{
|
||||
// @HACK: This is to prevent objects like deeprun tram from disappearing when player moves far from its spawn point while riding it
|
||||
if ((target->GetGOInfo()->type != GAMEOBJECT_TYPE_TRANSPORT))
|
||||
@@ -22574,14 +22574,14 @@ inline void UpdateVisibilityOf_helper(GuidSet& s64, GameObject* target, std::set
|
||||
}
|
||||
|
||||
template<>
|
||||
inline void UpdateVisibilityOf_helper(GuidSet& s64, Creature* target, std::set<Unit*>& v)
|
||||
inline void UpdateVisibilityOf_helper(GuidUnorderedSet& s64, Creature* target, std::set<Unit*>& v)
|
||||
{
|
||||
s64.insert(target->GetGUID());
|
||||
v.insert(target);
|
||||
}
|
||||
|
||||
template<>
|
||||
inline void UpdateVisibilityOf_helper(GuidSet& s64, Player* target, std::set<Unit*>& v)
|
||||
inline void UpdateVisibilityOf_helper(GuidUnorderedSet& s64, Player* target, std::set<Unit*>& v)
|
||||
{
|
||||
s64.insert(target->GetGUID());
|
||||
v.insert(target);
|
||||
@@ -22643,7 +22643,7 @@ void Player::UpdateTriggerVisibility()
|
||||
|
||||
UpdateData udata;
|
||||
WorldPacket packet;
|
||||
for (GuidSet::iterator itr = m_clientGUIDs.begin(); itr != m_clientGUIDs.end(); ++itr)
|
||||
for (auto itr = m_clientGUIDs.begin(); itr != m_clientGUIDs.end(); ++itr)
|
||||
{
|
||||
if (itr->IsCreature())
|
||||
{
|
||||
@@ -23702,7 +23702,7 @@ void Player::UpdateForQuestWorldObjects()
|
||||
|
||||
UpdateData udata;
|
||||
WorldPacket packet;
|
||||
for (GuidSet::iterator itr = m_clientGUIDs.begin(); itr != m_clientGUIDs.end(); ++itr)
|
||||
for (auto itr = m_clientGUIDs.begin(); itr != m_clientGUIDs.end(); ++itr)
|
||||
{
|
||||
if (itr->IsGameObject())
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user