From e9a8cea018591334ce3807e2eb2fc2d6ce079252 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 --- .../BlackrockSpire/instance_blackrock_spire.cpp | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'src/server/scripts/EasternKingdoms') 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 fd8e1b493e3..0ef21d99ba9 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/instance_blackrock_spire.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/instance_blackrock_spire.cpp @@ -415,11 +415,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])) { @@ -430,10 +429,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()); } } } @@ -454,9 +450,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; } @@ -531,7 +527,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