Use GUIDs instead of "global" pointers in zone scripts.
This commit is like that: 7714 / rce505237e4aa And use const_iterators where it is possible. --HG-- branch : trunk
This commit is contained in:
@@ -488,7 +488,7 @@ struct npc_geezleAI : public ScriptedAI
|
||||
Trinity::PlayerListSearcher<Trinity::AnyPlayerInObjectRangeCheck> searcher(m_creature, players, checker);
|
||||
m_creature->VisitNearbyWorldObject(radius, searcher);
|
||||
|
||||
for (std::list<Player*>::iterator itr = players.begin(); itr != players.end(); ++itr)
|
||||
for (std::list<Player*>::const_iterator itr = players.begin(); itr != players.end(); ++itr)
|
||||
{
|
||||
if((*itr)->GetQuestStatus(QUEST_TREES_COMPANY)==QUEST_STATUS_INCOMPLETE
|
||||
&&(*itr)->HasAura(SPELL_TREE_DISGUISE) )
|
||||
@@ -505,7 +505,7 @@ struct npc_geezleAI : public ScriptedAI
|
||||
|
||||
if (!FlagList.empty())
|
||||
{
|
||||
for (std::list<GameObject*>::iterator itr = FlagList.begin(); itr != FlagList.end(); ++itr)
|
||||
for (std::list<GameObject*>::const_iterator itr = FlagList.begin(); itr != FlagList.end(); ++itr)
|
||||
{
|
||||
if (despawn)
|
||||
{
|
||||
|
||||
@@ -72,7 +72,7 @@ struct boss_azuregosAI : public ScriptedAI
|
||||
{
|
||||
DoScriptText(SAY_TELEPORT, m_creature);
|
||||
std::list<HostileReference*>& m_threatlist = m_creature->getThreatManager().getThreatList();
|
||||
std::list<HostileReference*>::iterator i = m_threatlist.begin();
|
||||
std::list<HostileReference*>::const_iterator i = m_threatlist.begin();
|
||||
for (i = m_threatlist.begin(); i!= m_threatlist.end(); ++i)
|
||||
{
|
||||
Unit* pUnit = Unit::GetUnit((*m_creature), (*i)->getUnitGuid());
|
||||
|
||||
@@ -307,7 +307,7 @@ struct boss_archimondeAI : public hyjal_trashAI
|
||||
return false;
|
||||
|
||||
std::list<Unit*> targets;
|
||||
std::list<HostileReference*>::iterator itr = m_threatlist.begin();
|
||||
std::list<HostileReference*>::const_iterator itr = m_threatlist.begin();
|
||||
for (; itr != m_threatlist.end(); ++itr)
|
||||
{
|
||||
Unit* pUnit = Unit::GetUnit((*m_creature), (*itr)->getUnitGuid());
|
||||
|
||||
@@ -153,7 +153,7 @@ struct boss_kazrogalAI : public hyjal_trashAI
|
||||
m_creature->CastCustomSpell(m_creature, SPELL_MARK, NULL, NULL, NULL, false, NULL, NULL, m_creature->GetGUID());
|
||||
|
||||
std::list<HostileReference *> t_list = m_creature->getThreatManager().getThreatList();
|
||||
for (std::list<HostileReference *>::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
|
||||
for (std::list<HostileReference *>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
|
||||
{
|
||||
Unit *pTarget = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid());
|
||||
if (pTarget && pTarget->GetTypeId() == TYPEID_PLAYER && pTarget->getPowerType() == POWER_MANA)
|
||||
|
||||
@@ -950,7 +950,7 @@ void hyjalAI::HideNearPos(float x, float y)
|
||||
|
||||
if (!creatures.empty())
|
||||
{
|
||||
for (std::list<Creature*>::iterator itr = creatures.begin(); itr != creatures.end(); ++itr)
|
||||
for (std::list<Creature*>::const_iterator itr = creatures.begin(); itr != creatures.end(); ++itr)
|
||||
{
|
||||
(*itr)->SetVisibility(VISIBILITY_OFF);
|
||||
(*itr)->setFaction(35);//make them friendly so mobs won't attack them
|
||||
@@ -1007,7 +1007,7 @@ void hyjalAI::WaypointReached(uint32 i)
|
||||
|
||||
if (!creatures.empty())
|
||||
{
|
||||
for (std::list<Creature*>::iterator itr = creatures.begin(); itr != creatures.end(); ++itr)
|
||||
for (std::list<Creature*>::const_iterator itr = creatures.begin(); itr != creatures.end(); ++itr)
|
||||
{
|
||||
if ((*itr) && (*itr)->isAlive() && (*itr) != m_creature && (*itr)->GetEntry() != JAINA)
|
||||
{
|
||||
@@ -1048,7 +1048,7 @@ void hyjalAI::DoOverrun(uint32 faction, const uint32 diff)
|
||||
|
||||
if (!creatures.empty())
|
||||
{
|
||||
for (std::list<Creature*>::iterator itr = creatures.begin(); itr != creatures.end(); ++itr)
|
||||
for (std::list<Creature*>::const_iterator itr = creatures.begin(); itr != creatures.end(); ++itr)
|
||||
{
|
||||
if ((*itr) && (*itr)->isAlive())
|
||||
{
|
||||
|
||||
@@ -220,7 +220,7 @@ struct instance_mount_hyjal : public ScriptedInstance
|
||||
{
|
||||
if (!m_uiAncientGemGUID.empty())
|
||||
{
|
||||
for (std::list<uint64>::iterator itr = m_uiAncientGemGUID.begin(); itr != m_uiAncientGemGUID.end(); ++itr)
|
||||
for (std::list<uint64>::const_iterator itr = m_uiAncientGemGUID.begin(); itr != m_uiAncientGemGUID.end(); ++itr)
|
||||
{
|
||||
//don't know how long it expected
|
||||
DoRespawnGameObject(*itr,DAY);
|
||||
|
||||
@@ -784,7 +784,7 @@ struct mob_qiraj_war_spawnAI : public ScriptedAI
|
||||
uint32 SpellTimer1, SpellTimer2, SpellTimer3,SpellTimer4;
|
||||
bool Timers;
|
||||
bool hasTarget;
|
||||
Unit* trigger;
|
||||
|
||||
void Reset()
|
||||
{
|
||||
MobGUID = 0;
|
||||
@@ -861,7 +861,7 @@ struct mob_qiraj_war_spawnAI : public ScriptedAI
|
||||
if(pTarget)
|
||||
m_creature->AI()->AttackStart(pTarget);
|
||||
}
|
||||
if (!(trigger = m_creature->FindNearestCreature(15379,100)))
|
||||
if (!(m_creature->FindNearestCreature(15379,100)))
|
||||
DoCast(m_creature, 33652);
|
||||
|
||||
if (!UpdateVictim())
|
||||
@@ -966,7 +966,7 @@ struct npc_anachronos_quest_triggerAI : public ScriptedAI
|
||||
|
||||
const Group::MemberSlotList members = EventGroup->GetMemberSlots();
|
||||
|
||||
for (Group::member_citerator itr = members.begin(); itr!= members.end(); itr++)
|
||||
for (Group::member_citerator itr = members.begin(); itr!= members.end(); ++itr)
|
||||
{
|
||||
GroupMember = (Unit::GetPlayer(itr->guid));
|
||||
if(!GroupMember)
|
||||
@@ -1039,7 +1039,7 @@ bool GOQuestAccept_GO_crystalline_tear(Player* plr, GameObject* go, Quest const*
|
||||
Unit *Merithra = Anachronos_Quest_Trigger->SummonCreature(15378,-8034.535,1535.14,2.61,0,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,150000);
|
||||
Unit *Caelestrasz = Anachronos_Quest_Trigger->SummonCreature(15379,-8032.767, 1533.148,2.61, 1.5,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,150000);
|
||||
Unit *Arygos = Anachronos_Quest_Trigger->SummonCreature(15380,-8034.52, 1537.843, 2.61, 5.7,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,150000);
|
||||
Unit *Fandral = Anachronos_Quest_Trigger->SummonCreature(15382,-8028.462, 1535.843, 2.61, 3.141592,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,215000);
|
||||
/* Unit *Fandral = */ Anachronos_Quest_Trigger->SummonCreature(15382,-8028.462, 1535.843, 2.61, 3.141592,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,215000);
|
||||
Creature *Anachronos = Anachronos_Quest_Trigger->SummonCreature(15381,-8028.75, 1538.795, 2.61, 4,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,220000);
|
||||
|
||||
if(Merithra)
|
||||
|
||||
@@ -461,7 +461,7 @@ struct npc_toogaAI : public FollowerAI
|
||||
uint32 m_uiPostEventTimer;
|
||||
uint32 m_uiPhasePostEvent;
|
||||
|
||||
Unit* pTorta;
|
||||
uint64 TortaGUID;
|
||||
|
||||
void Reset()
|
||||
{
|
||||
@@ -469,7 +469,7 @@ struct npc_toogaAI : public FollowerAI
|
||||
m_uiPostEventTimer = 1000;
|
||||
m_uiPhasePostEvent = 0;
|
||||
|
||||
pTorta = NULL;
|
||||
TortaGUID = 0;
|
||||
}
|
||||
|
||||
void MoveInLineOfSight(Unit *pWho)
|
||||
@@ -486,7 +486,7 @@ struct npc_toogaAI : public FollowerAI
|
||||
pPlayer->GroupEventHappens(QUEST_TOOGA, m_creature);
|
||||
}
|
||||
|
||||
pTorta = pWho;
|
||||
TortaGUID = pWho->GetGUID();
|
||||
SetFollowComplete(true);
|
||||
}
|
||||
}
|
||||
@@ -514,6 +514,7 @@ struct npc_toogaAI : public FollowerAI
|
||||
{
|
||||
m_uiPostEventTimer = 5000;
|
||||
|
||||
Unit *pTorta = Unit::GetUnit(*m_creature, TortaGUID);
|
||||
if (!pTorta || !pTorta->isAlive())
|
||||
{
|
||||
//something happened, so just complete
|
||||
|
||||
@@ -541,10 +541,10 @@ struct cthunAI : public Scripted_NoMovementAI
|
||||
if (Stomach_Map.empty())
|
||||
return NULL;
|
||||
|
||||
UNORDERED_MAP<uint64, bool>::iterator i = Stomach_Map.begin();
|
||||
UNORDERED_MAP<uint64, bool>::const_iterator i = Stomach_Map.begin();
|
||||
|
||||
std::list<Unit*> temp;
|
||||
std::list<Unit*>::iterator j;
|
||||
std::list<Unit*>::const_iterator j;
|
||||
|
||||
//Get all players in map
|
||||
while (i != Stomach_Map.end())
|
||||
@@ -654,7 +654,7 @@ struct cthunAI : public Scripted_NoMovementAI
|
||||
//Place all units in threat list on outside of stomach
|
||||
Stomach_Map.clear();
|
||||
|
||||
std::list<HostileReference*>::iterator i = m_creature->getThreatManager().getThreatList().begin();
|
||||
std::list<HostileReference*>::const_iterator i = m_creature->getThreatManager().getThreatList().begin();
|
||||
for (; i != m_creature->getThreatManager().getThreatList().end(); ++i)
|
||||
{
|
||||
//Outside stomach
|
||||
|
||||
@@ -320,7 +320,7 @@ struct boss_twinemperorsAI : public ScriptedAI
|
||||
|
||||
Creature *nearb = NULL;
|
||||
|
||||
for (std::list<Creature*>::iterator iter = lUnitList.begin(); iter != lUnitList.end(); ++iter)
|
||||
for (std::list<Creature*>::const_iterator iter = lUnitList.begin(); iter != lUnitList.end(); ++iter)
|
||||
{
|
||||
Creature *c = *iter;
|
||||
if (c)
|
||||
|
||||
@@ -145,7 +145,7 @@ struct aqsentinelAI : public ScriptedAI
|
||||
if (assistList.empty())
|
||||
return;
|
||||
|
||||
for (std::list<Creature*>::iterator iter = assistList.begin(); iter != assistList.end(); ++iter)
|
||||
for (std::list<Creature*>::const_iterator iter = assistList.begin(); iter != assistList.end(); ++iter)
|
||||
AddBuddyToList((*iter)->GetGUID());
|
||||
}
|
||||
|
||||
@@ -249,7 +249,7 @@ struct aqsentinelAI : public ScriptedAI
|
||||
|
||||
Unit *GetHatedManaUser() const
|
||||
{
|
||||
std::list<HostileReference*>::iterator i;
|
||||
std::list<HostileReference*>::const_iterator i;
|
||||
for (i = m_creature->getThreatManager().getThreatList().begin(); i != m_creature->getThreatManager().getThreatList().end(); ++i)
|
||||
{
|
||||
Unit* pUnit = Unit::GetUnit((*m_creature), (*i)->getUnitGuid());
|
||||
|
||||
@@ -175,14 +175,14 @@ struct npc_ringoAI : public FollowerAI
|
||||
uint32 m_uiEndEventProgress;
|
||||
uint32 m_uiEndEventTimer;
|
||||
|
||||
Unit* pSpraggle;
|
||||
uint64 SpraggleGUID;
|
||||
|
||||
void Reset()
|
||||
{
|
||||
m_uiFaintTimer = urand(30000, 60000);
|
||||
m_uiEndEventProgress = 0;
|
||||
m_uiEndEventTimer = 1000;
|
||||
pSpraggle = NULL;
|
||||
SpraggleGUID = 0;
|
||||
}
|
||||
|
||||
void MoveInLineOfSight(Unit *pWho)
|
||||
@@ -199,7 +199,7 @@ struct npc_ringoAI : public FollowerAI
|
||||
pPlayer->GroupEventHappens(QUEST_A_LITTLE_HELP, m_creature);
|
||||
}
|
||||
|
||||
pSpraggle = pWho;
|
||||
SpraggleGUID = pWho->GetGUID();
|
||||
SetFollowComplete(true);
|
||||
}
|
||||
}
|
||||
@@ -244,6 +244,7 @@ struct npc_ringoAI : public FollowerAI
|
||||
{
|
||||
if (m_uiEndEventTimer <= uiDiff)
|
||||
{
|
||||
Unit *pSpraggle = Unit::GetUnit(*m_creature, SpraggleGUID);
|
||||
if (!pSpraggle || !pSpraggle->isAlive())
|
||||
{
|
||||
SetFollowComplete();
|
||||
|
||||
Reference in New Issue
Block a user