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

@@ -699,7 +699,7 @@ public:
if (counter > 12)
{
bool failed = false;
for (ObjectGuid const guid : unitList)
for (ObjectGuid const& guid : unitList)
if (Unit* c = ObjectAccessor::GetUnit(*me, guid))
if (c->HasAuraType(SPELL_AURA_PERIODIC_DUMMY))
{
@@ -753,7 +753,7 @@ public:
Unit* getTrigger()
{
std::list<Unit*> tmpList;
for (ObjectGuid const guid : unitList)
for (ObjectGuid const& guid : unitList)
if (Unit* c = ObjectAccessor::GetUnit(*me, guid))
if (!c->HasAuraType(SPELL_AURA_PERIODIC_DUMMY))
tmpList.push_back(c);
@@ -772,7 +772,7 @@ public:
{
me->MonsterYell("Fire consumes! You've tried and failed. Let there be no doubt, justice prevailed!", LANG_UNIVERSAL, 0);
me->PlayDirectSound(11967);
for (ObjectGuid const guid : unitList)
for (ObjectGuid const& guid : unitList)
if (Unit* c = ObjectAccessor::GetUnit(*me, guid))
c->RemoveAllAuras();