From f0d8df8909cf7aaccdbe805fb37ff4b8c2fcd5ce Mon Sep 17 00:00:00 2001 From: jackpoz Date: Sat, 12 Jun 2021 16:32:00 +0200 Subject: Scripts/UBRS: Fix crash Fix crash triggered during Dragonspire Hall event caused by having more than 5 mobs near a rune. Crash added in 7c19fb8d0eae64db0719cc2b110fcc06f60542ac Fix #26589 (cherry picked from commit e9a8cea018591334ce3807e2eb2fc2d6ce079252) --- .../BlackrockSpire/instance_blackrock_spire.cpp | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/instance_blackrock_spire.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/instance_blackrock_spire.cpp index 96d71073c7b..56051ab4c0c 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/instance_blackrock_spire.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/instance_blackrock_spire.cpp @@ -412,11 +412,10 @@ public: void Dragonspireroomstore() { - uint8 creatureCount; - for (uint8 i = 0; i < 7; ++i) { - creatureCount = 0; + // Refresh the creature list + runecreaturelist[i].clear(); if (GameObject* rune = instance->GetGameObject(go_roomrunes[i])) { @@ -427,10 +426,7 @@ public: for (std::list::iterator itr = creatureList.begin(); itr != creatureList.end(); ++itr) { if (Creature* creature = *itr) - { - runecreaturelist[i][creatureCount] = creature->GetGUID(); - ++creatureCount; - } + runecreaturelist[i].push_back(creature->GetGUID()); } } } @@ -451,9 +447,9 @@ public: if (rune->GetGoState() == GO_STATE_ACTIVE) { - for (uint8 ii = 0; ii < 5; ++ii) + for (ObjectGuid const& guid : runecreaturelist[i]) { - mob = instance->GetCreature(runecreaturelist[i][ii]); + mob = instance->GetCreature(guid); if (mob && mob->IsAlive()) _mobAlive = true; } @@ -528,7 +524,7 @@ public: ObjectGuid go_blackrockaltar; ObjectGuid go_roomrunes[7]; ObjectGuid go_emberseerrunes[7]; - ObjectGuid runecreaturelist[7][5]; + GuidVector runecreaturelist[7]; ObjectGuid go_portcullis_active; ObjectGuid go_portcullis_tobossrooms; GuidList _incarceratorList; -- cgit v1.2.3