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

@@ -328,7 +328,7 @@ inline void Battleground::_ProcessResurrect(uint32 diff)
for (std::map<ObjectGuid, GuidVector>::iterator itr = m_ReviveQueue.begin(); itr != m_ReviveQueue.end(); ++itr)
{
Creature* sh = nullptr;
for (ObjectGuid const guid : itr->second)
for (ObjectGuid const& guid : itr->second)
{
Player* player = ObjectAccessor::FindPlayer(guid);
if (!player)
@@ -360,7 +360,7 @@ inline void Battleground::_ProcessResurrect(uint32 diff)
}
else if (m_LastResurrectTime > 500) // Resurrect players only half a second later, to see spirit heal effect on NPC
{
for (ObjectGuid const guid : m_ResurrectQueue)
for (ObjectGuid const& guid : m_ResurrectQueue)
{
Player* player = ObjectAccessor::FindPlayer(guid);
if (!player)
@@ -1479,7 +1479,7 @@ void Battleground::RelocateDeadPlayers(ObjectGuid queueIndex)
if (!ghostList.empty())
{
GraveyardStruct const* closestGrave = nullptr;
for (ObjectGuid const guid : ghostList)
for (ObjectGuid const& guid : ghostList)
{
Player* player = ObjectAccessor::FindPlayer(guid);
if (!player)

View File

@@ -897,7 +897,7 @@ void BattlegroundSA::CaptureGraveyard(BG_SA_Graveyards i, Player* Source)
if (!ghost_list.empty())
{
GraveyardStruct const* ClosestGrave = nullptr;
for (ObjectGuid const guid : ghost_list)
for (ObjectGuid const& guid : ghost_list)
{
Player* player = ObjectAccessor::FindPlayer(guid);
if (!player)