diff options
author | jackpoz <giacomopoz@gmail.com> | 2021-06-12 16:32:00 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2022-03-11 01:48:32 +0100 |
commit | f0d8df8909cf7aaccdbe805fb37ff4b8c2fcd5ce (patch) | |
tree | 1025acf0ef955ab4732aa4efe519d925af6865bd /src | |
parent | a232e864847dabeae74222f173c4b43f3a45a1fd (diff) |
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)
Diffstat (limited to 'src')
-rw-r--r-- | src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/instance_blackrock_spire.cpp | 16 |
1 files changed, 6 insertions, 10 deletions
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<Creature*>::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; |