mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-22 21:26:23 +00:00
fix(Core/ObjectGuid): prevent creating copies when looping objects (#6852)
This commit is contained in:
@@ -279,7 +279,7 @@ public:
|
||||
case INSTANCE_PROGRESS_CHAMPION_GROUP_DIED_3:
|
||||
// revert to INSTANCE_PROGRESS_INITIAL
|
||||
{
|
||||
for (ObjectGuid const guid : VehicleList)
|
||||
for (ObjectGuid const& guid : VehicleList)
|
||||
if (Creature* veh = instance->GetCreature(guid))
|
||||
{
|
||||
veh->DespawnOrUnsummon();
|
||||
@@ -567,7 +567,7 @@ public:
|
||||
{
|
||||
Counter = 0;
|
||||
InstanceProgress = INSTANCE_PROGRESS_CHAMPIONS_UNMOUNTED;
|
||||
for (ObjectGuid const guid : VehicleList)
|
||||
for (ObjectGuid const& guid : VehicleList)
|
||||
if (Creature* veh = instance->GetCreature(guid))
|
||||
veh->DespawnOrUnsummon();
|
||||
events.ScheduleEvent(EVENT_GRAND_CHAMPIONS_MOVE_SIDE, 0);
|
||||
|
||||
@@ -200,7 +200,7 @@ public:
|
||||
if( !IsHeroic() )
|
||||
events.RescheduleEvent(EVENT_RESPAWN_SPHERE, 4000);
|
||||
|
||||
for (ObjectGuid guid : summons)
|
||||
for (ObjectGuid const& guid : summons)
|
||||
if (pInstance)
|
||||
if (Creature* c = pInstance->instance->GetCreature(guid))
|
||||
{
|
||||
|
||||
@@ -73,7 +73,7 @@ public:
|
||||
|
||||
// move corpses
|
||||
const ObjectGuid npcs[4] = { NPC_IcehowlGUID, NPC_JaraxxusGUID, NPC_LightbaneGUID, NPC_DarkbaneGUID };
|
||||
for (const ObjectGuid i : npcs)
|
||||
for (ObjectGuid const& i : npcs)
|
||||
{
|
||||
if (Creature* c = instance->GetCreature(i))
|
||||
{
|
||||
@@ -402,7 +402,7 @@ public:
|
||||
InstanceProgress = INSTANCE_PROGRESS_FACTION_CHAMPIONS_DEAD;
|
||||
events.RescheduleEvent(EVENT_SCENE_FACTION_CHAMPIONS_DEAD, 2500);
|
||||
|
||||
for (ObjectGuid guid : NPC_ChampionGUIDs)
|
||||
for (ObjectGuid const& guid : NPC_ChampionGUIDs)
|
||||
if (Creature* c = instance->GetCreature(guid))
|
||||
c->DespawnOrUnsummon(15000);
|
||||
NPC_ChampionGUIDs.clear();
|
||||
@@ -455,7 +455,7 @@ public:
|
||||
{
|
||||
EncounterStatus = IN_PROGRESS;
|
||||
AchievementTimer = 0;
|
||||
for (ObjectGuid guid : NPC_ChampionGUIDs)
|
||||
for (ObjectGuid const& guid : NPC_ChampionGUIDs)
|
||||
if (Creature* c = instance->GetCreature(guid))
|
||||
if (!c->IsInCombat())
|
||||
if (Unit* target = c->SelectNearestTarget(200.0f))
|
||||
@@ -1093,7 +1093,7 @@ public:
|
||||
}
|
||||
case EVENT_CHAMPIONS_ATTACK:
|
||||
{
|
||||
for (ObjectGuid guid : NPC_ChampionGUIDs)
|
||||
for (ObjectGuid const& guid : NPC_ChampionGUIDs)
|
||||
if (Creature* c = instance->GetCreature(guid))
|
||||
{
|
||||
c->SetReactState(REACT_AGGRESSIVE);
|
||||
@@ -1493,7 +1493,7 @@ public:
|
||||
case INSTANCE_PROGRESS_JARAXXUS_DEAD:
|
||||
if( Creature* c = instance->GetCreature(NPC_BarrettGUID) )
|
||||
c->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
|
||||
for (ObjectGuid guid : NPC_ChampionGUIDs)
|
||||
for (ObjectGuid const& guid : NPC_ChampionGUIDs)
|
||||
if (Creature* c = instance->GetCreature(guid))
|
||||
c->DespawnOrUnsummon();
|
||||
NPC_ChampionGUIDs.clear();
|
||||
|
||||
Reference in New Issue
Block a user