fix(Core/ObjectGuid): prevent creating copies when looping objects (#6852)

This commit is contained in:
Francesco Borzì
2021-07-10 15:54:16 +02:00
committed by GitHub
parent 2fcafa5f39
commit 4103fca5a4
40 changed files with 69 additions and 69 deletions

View File

@@ -212,7 +212,7 @@ void GameObject::ClearRitualList()
if (!animSpell || m_unique_users.empty())
return;
for (ObjectGuid const guid : m_unique_users)
for (ObjectGuid const& guid : m_unique_users)
{
if (Player* channeler = ObjectAccessor::GetPlayer(*this, guid))
if (Spell* spell = channeler->GetCurrentSpell(CURRENT_CHANNELED_SPELL))

View File

@@ -843,7 +843,7 @@ public:
void AddToSkillupList(ObjectGuid playerGuid) { m_SkillupList.push_back(playerGuid); }
[[nodiscard]] bool IsInSkillupList(ObjectGuid playerGuid) const
{
for (ObjectGuid const guid : m_SkillupList)
for (ObjectGuid const& guid : m_SkillupList)
if (guid == playerGuid)
return true;

View File

@@ -104,7 +104,7 @@ bool UpdateData::BuildPacket(WorldPacket* packet)
buf << (uint8) UPDATETYPE_OUT_OF_RANGE_OBJECTS;
buf << (uint32) m_outOfRangeGUIDs.size();
for (ObjectGuid const guid : m_outOfRangeGUIDs)
for (ObjectGuid const& guid : m_outOfRangeGUIDs)
{
buf << guid.WriteAsPacked();
}