mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-02-15 16:26:08 +00:00
fix(Core/ObjectGuid): prevent creating copies when looping objects (#6852)
This commit is contained in:
@@ -220,7 +220,7 @@ public:
|
||||
{
|
||||
if (!m_uiAncientGemGUID.empty())
|
||||
{
|
||||
for (ObjectGuid const guid : m_uiAncientGemGUID)
|
||||
for (ObjectGuid const& guid : m_uiAncientGemGUID)
|
||||
{
|
||||
//don't know how long it expected
|
||||
DoRespawnGameObject(guid, DAY);
|
||||
|
||||
@@ -183,7 +183,7 @@ public:
|
||||
instance->LoadGrid(instancePositions[0].GetPositionX(), instancePositions[0].GetPositionY());
|
||||
instance->LoadGrid(instancePositions[1].GetPositionX(), instancePositions[1].GetPositionY());
|
||||
|
||||
for (ObjectGuid const guid : _prisonersSet)
|
||||
for (ObjectGuid const& guid : _prisonersSet)
|
||||
if (Creature* orc = instance->GetCreature(guid))
|
||||
{
|
||||
uint8 index = orc->GetDistance(instancePositions[0]) < 80.0f ? 0 : 1;
|
||||
@@ -193,7 +193,7 @@ public:
|
||||
orc->SetStandState(UNIT_STAND_STATE_STAND);
|
||||
}
|
||||
|
||||
for (ObjectGuid const guid : _initalFlamesSet)
|
||||
for (ObjectGuid const& guid : _initalFlamesSet)
|
||||
if (GameObject* gobject = instance->GetGameObject(guid))
|
||||
{
|
||||
gobject->SetRespawnTime(0);
|
||||
@@ -215,14 +215,14 @@ public:
|
||||
player->KilledMonsterCredit(NPC_LODGE_QUEST_TRIGGER);
|
||||
}
|
||||
|
||||
for (ObjectGuid const guid : _finalFlamesSet)
|
||||
for (ObjectGuid const& guid : _finalFlamesSet)
|
||||
if (GameObject* gobject = instance->GetGameObject(guid))
|
||||
{
|
||||
gobject->SetRespawnTime(0);
|
||||
gobject->UpdateObjectVisibility(true);
|
||||
}
|
||||
|
||||
for (ObjectGuid const guid : _prisonersSet)
|
||||
for (ObjectGuid const& guid : _prisonersSet)
|
||||
if (Creature* orc = instance->GetCreature(guid))
|
||||
if (roll_chance_i(25))
|
||||
orc->HandleEmoteCommand(EMOTE_ONESHOT_CHEER);
|
||||
|
||||
@@ -60,7 +60,7 @@ public:
|
||||
}
|
||||
|
||||
GuidSet eCopy = encounterNPCs;
|
||||
for (ObjectGuid const guid : eCopy)
|
||||
for (ObjectGuid const& guid : eCopy)
|
||||
if (Creature* creature = instance->GetCreature(guid))
|
||||
creature->DespawnOrUnsummon();
|
||||
}
|
||||
@@ -184,7 +184,7 @@ public:
|
||||
|
||||
// Xinef: delete all spawns
|
||||
GuidSet eCopy = encounterNPCs;
|
||||
for (ObjectGuid guid : eCopy)
|
||||
for (ObjectGuid const& guid : eCopy)
|
||||
if (Creature* creature = instance->GetCreature(guid))
|
||||
creature->DespawnOrUnsummon();
|
||||
}
|
||||
@@ -227,7 +227,7 @@ public:
|
||||
void SummonPortalKeeper()
|
||||
{
|
||||
Creature* rift = nullptr;
|
||||
for (ObjectGuid const guid : encounterNPCs)
|
||||
for (ObjectGuid const& guid : encounterNPCs)
|
||||
if (Creature* summon = instance->GetCreature(guid))
|
||||
if (summon->GetEntry() == NPC_TIME_RIFT)
|
||||
{
|
||||
|
||||
@@ -79,7 +79,7 @@ public:
|
||||
bDeepBreath = true;
|
||||
if( uiData == NOT_STARTED )
|
||||
{
|
||||
for (ObjectGuid guid : minions)
|
||||
for (ObjectGuid const& guid : minions)
|
||||
if (Creature* c = instance->GetCreature(guid))
|
||||
c->DespawnOrUnsummon();
|
||||
minions.clear();
|
||||
|
||||
@@ -187,7 +187,7 @@ public:
|
||||
events.ScheduleEvent(EVENT_PARALYZE, 15000);
|
||||
break;
|
||||
case EVENT_SWARMER_ATTACK:
|
||||
for (ObjectGuid guid : _swarmers)
|
||||
for (ObjectGuid const& guid : _swarmers)
|
||||
if (Creature* swarmer = me->GetMap()->GetCreature(guid))
|
||||
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM))
|
||||
swarmer->AI()->AttackStart(target);
|
||||
|
||||
@@ -63,7 +63,7 @@ public:
|
||||
{
|
||||
BossAI::EnterEvadeMode();
|
||||
|
||||
for (ObjectGuid guid : Eggs)
|
||||
for (ObjectGuid const& guid : Eggs)
|
||||
if (Creature* egg = me->GetMap()->GetCreature(guid))
|
||||
egg->Respawn();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user