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

@@ -209,7 +209,7 @@ public:
bool bIsWaterElementsAlive = false;
if (!globules.empty())
{
for (ObjectGuid const guid : globules)
for (ObjectGuid const& guid : globules)
if (Creature* pTemp = ObjectAccessor::GetCreature(*me, guid))
if (pTemp->IsAlive())
{

View File

@@ -124,7 +124,7 @@ public:
{
bool found = false;
if (pInstance)
for (ObjectGuid guid : spheres)
for (ObjectGuid const& guid : spheres)
if (Creature* c = pInstance->instance->GetCreature(guid))
if (me->GetDistance(c) < 3.0f)
{

View File

@@ -434,7 +434,7 @@ public:
DoUpdateWorldState(WORLD_STATE_VH_PRISON_STATE, (uint32)GateHealth);
DoUpdateWorldState(WORLD_STATE_VH_WAVE_COUNT, (uint32)WaveCount);
for (ObjectGuid guid : GO_ActivationCrystalGUID)
for (ObjectGuid const& guid : GO_ActivationCrystalGUID)
if (GameObject* go = instance->GetGameObject(guid))
{
HandleGameObject(ObjectGuid::Empty, false, go); // not used yet
@@ -528,7 +528,7 @@ public:
CLEANED = true;
// reset defense crystals
for (ObjectGuid guid : GO_ActivationCrystalGUID)
for (ObjectGuid const& guid : GO_ActivationCrystalGUID)
if (GameObject* go = instance->GetGameObject(guid))
{
HandleGameObject(ObjectGuid::Empty, false, go); // not used yet
@@ -555,7 +555,7 @@ public:
NPC_PortalGUID.Clear();
// remove trash
for (ObjectGuid guid : trashMobs)
for (ObjectGuid const& guid : trashMobs)
if (Creature* c = instance->GetCreature(guid))
c->DespawnOrUnsummon();