From 19e7622bd3f3d2c0b1bfe65892f25d035b9e222b Mon Sep 17 00:00:00 2001 From: Staden Date: Sun, 12 Mar 2017 22:54:38 +0000 Subject: [PATCH] Iterate over the Nightmare Dragon GUIDs in a slightly better way --- src/game/HardcodedEvents.cpp | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/game/HardcodedEvents.cpp b/src/game/HardcodedEvents.cpp index cb0e49122..453ac0bb1 100644 --- a/src/game/HardcodedEvents.cpp +++ b/src/game/HardcodedEvents.cpp @@ -348,16 +348,13 @@ void DragonsOfNightmare::CheckNightmareDragonsVariables(uint32 &aliveCount, uint void DragonsOfNightmare::UpdateRespawnTimeForDeadDragons(std::vector &dragons, time_t respawnTime) { - if (dragons.empty()) - return; - - for (uint8 i = 0; i < 4; ++i) + for (auto& guid : dragons) { - auto cData = sObjectMgr.GetCreatureData(dragons[i].GetCounter()); + auto cData = sObjectMgr.GetCreatureData(guid.GetCounter()); if (!cData) { - sLog.outError("GameEventMgr: [Dragons of Nightmare] creature data %u not found!", dragons[i].GetCounter()); + sLog.outError("GameEventMgr: [Dragons of Nightmare] creature data %u not found!", guid.GetCounter()); continue; } @@ -372,16 +369,16 @@ void DragonsOfNightmare::UpdateRespawnTimeForDeadDragons(std::vector continue; } - auto pCreature = map->GetCreature(dragons[i]); + auto pCreature = map->GetCreature(guid); if (!pCreature) { - sLog.outError("GameEventMgr: [Dragons of Nightmare] creature %u not found!", dragons[i].GetCounter()); + sLog.outError("GameEventMgr: [Dragons of Nightmare] creature %u not found!", guid.GetCounter()); continue; } if (pCreature->isDead()) - map->GetPersistentState()->SaveCreatureRespawnTime(dragons[i].GetCounter(), respawnTime); + map->GetPersistentState()->SaveCreatureRespawnTime(guid.GetCounter(), respawnTime); } }