Core/Globals: throw some RAII into ObjectMgr, and load templates into vectors

Ref #14274

(cherry picked from commit b64c504314)
This commit is contained in:
ariel-
2018-01-17 02:17:49 -03:00
committed by Shauren
parent 5b5bc4c5c7
commit 21556667c1
11 changed files with 343 additions and 329 deletions

View File

@@ -770,9 +770,8 @@ void InstanceScript::UpdateEncounterState(EncounterCreditType type, uint32 credi
uint32 dungeonId = 0;
for (DungeonEncounterList::const_iterator itr = encounters->begin(); itr != encounters->end(); ++itr)
for (auto const& encounter : *encounters)
{
DungeonEncounter const* encounter = *itr;
if (encounter->creditType == type && encounter->creditEntry == creditEntry)
{
completedEncounters |= 1 << encounter->dbcEntry->Bit;
@@ -789,15 +788,19 @@ void InstanceScript::UpdateEncounterState(EncounterCreditType type, uint32 credi
if (dungeonId)
{
Map::PlayerList const& players = instance->GetPlayers();
for (Map::PlayerList::const_iterator i = players.begin(); i != players.end(); ++i)
for (auto const& ref : players)
{
if (Player* player = i->GetSource())
if (Player* player = ref.GetSource())
{
if (Group* grp = player->GetGroup())
{
if (grp->isLFGGroup())
{
sLFGMgr->FinishDungeon(grp->GetGUID(), dungeonId, instance);
return;
}
}
}
}
}
}