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

@@ -291,7 +291,7 @@ public:
events.RepeatEvent(30000);
else
{
for (ObjectGuid guid : summons)
for (ObjectGuid const& guid : summons)
if (Creature* sv = ObjectAccessor::GetCreature(*me, guid))
{
sv->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);

View File

@@ -2321,7 +2321,7 @@ public:
void RemoveAll()
{
for (ObjectGuid guid : FlameList)
for (ObjectGuid const& guid : FlameList)
if (Creature* c = ObjectAccessor::GetCreature(*me, guid))
c->DespawnOrUnsummon();
FlameList.clear();

View File

@@ -1219,7 +1219,7 @@ void instance_ulduar::instance_ulduar_InstanceMapScript::SpawnLeviathanEncounter
{
if (!_leviathanVehicles.empty())
{
for (ObjectGuid guid : _leviathanVehicles)
for (ObjectGuid const& guid : _leviathanVehicles)
if (Creature* cr = instance->GetCreature(guid))
if (Vehicle* veh = cr->GetVehicleKit())
veh->Dismiss();