mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-02-16 00:36:07 +00:00
fix(Core/ObjectGuid): prevent creating copies when looping objects (#6852)
This commit is contained in:
@@ -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())
|
||||
{
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user