From 8034a6c48ea565345cd769422bb80acf5df015e4 Mon Sep 17 00:00:00 2001 From: Spp Date: Tue, 9 Mar 2010 11:11:10 +0100 Subject: Rename 'Hostil' to 'Hostile' Credits to NoFantasy (Mangos) Closes issue #411 --HG-- branch : trunk --- src/game/BattleGround.cpp | 2 +- src/game/CMakeLists.txt | 4 +- src/game/Chat.cpp | 2 +- src/game/Chat.h | 2 +- src/game/CombatAI.cpp | 2 +- src/game/CreatureEventAI.cpp | 14 +- src/game/Debugcmds.cpp | 8 +- src/game/HostilRefManager.cpp | 189 --------------------- src/game/HostilRefManager.h | 74 -------- src/game/HostileRefManager.cpp | 189 +++++++++++++++++++++ src/game/HostileRefManager.h | 74 ++++++++ src/game/Level2.cpp | 2 +- src/game/OutdoorPvPWG.cpp | 4 +- src/game/PetAI.cpp | 2 +- src/game/Player.cpp | 12 +- src/game/ScriptedCreature.cpp | 14 +- src/game/Spell.cpp | 4 +- src/game/SpellAuraEffects.cpp | 12 +- src/game/SpellEffects.cpp | 6 +- src/game/ThreatManager.cpp | 78 ++++----- src/game/ThreatManager.h | 42 ++--- src/game/Unit.cpp | 28 +-- src/game/Unit.h | 14 +- src/game/UnitAI.cpp | 12 +- src/game/UnitAI.h | 6 +- src/game/UnitEvents.h | 16 +- src/game/WaypointMovementGenerator.cpp | 2 +- src/game/WorldSession.cpp | 4 +- .../blackwing_lair/boss_chromaggus.cpp | 4 +- .../eastern_kingdoms/karazhan/boss_midnight.cpp | 4 +- .../karazhan/boss_prince_malchezaar.cpp | 4 +- .../karazhan/boss_shade_of_aran.cpp | 4 +- .../magisters_terrace/boss_felblood_kaelthas.cpp | 12 +- .../magisters_terrace/boss_priestess_delrissa.cpp | 8 +- .../scarlet_monastery/boss_headless_horseman.cpp | 2 +- .../sunwell_plateau/boss_kalecgos.cpp | 6 +- .../sunwell_plateau/boss_kiljaeden.cpp | 2 +- .../eastern_kingdoms/zulgurub/boss_mandokir.cpp | 2 +- src/scripts/kalimdor/boss_azuregos.cpp | 4 +- .../caverns_of_time/hyjal/boss_archimonde.cpp | 4 +- .../caverns_of_time/hyjal/boss_kazrogal.cpp | 4 +- .../kalimdor/temple_of_ahnqiraj/boss_cthun.cpp | 2 +- .../temple_of_ahnqiraj/mob_anubisath_sentinel.cpp | 2 +- .../azjol_nerub/ahnkahet/boss_prince_taldaram.cpp | 4 +- .../northrend/draktharon_keep/boss_tharon_ja.cpp | 8 +- src/scripts/northrend/naxxramas/boss_kelthuzad.cpp | 4 +- src/scripts/northrend/naxxramas/boss_patchwerk.cpp | 2 +- src/scripts/northrend/naxxramas/boss_sapphiron.cpp | 4 +- .../northrend/nexus/nexus/boss_keristrasza.cpp | 4 +- src/scripts/northrend/nexus/nexus/boss_ormorok.cpp | 2 +- .../boss_blackheart_the_inciter.cpp | 4 +- .../auchindoun/shadow_labyrinth/boss_murmur.cpp | 12 +- .../outland/black_temple/boss_bloodboil.cpp | 4 +- src/scripts/outland/black_temple/boss_illidan.cpp | 6 +- .../black_temple/boss_reliquary_of_souls.cpp | 8 +- src/scripts/outland/black_temple/boss_supremus.cpp | 4 +- .../outland/black_temple/boss_teron_gorefiend.cpp | 8 +- .../serpent_shrine/boss_lady_vashj.cpp | 4 +- .../serpent_shrine/boss_leotheras_the_blind.cpp | 4 +- .../outland/gruuls_lair/boss_high_king_maulgar.cpp | 4 +- src/scripts/outland/netherstorm.cpp | 4 +- src/scripts/outland/shadowmoon_valley.cpp | 2 +- .../outland/tempest_keep/the_eye/boss_kaelthas.cpp | 6 +- .../tempest_keep/the_eye/boss_void_reaver.cpp | 4 +- win/VC90/game.vcproj | 4 +- 65 files changed, 494 insertions(+), 494 deletions(-) delete mode 100644 src/game/HostilRefManager.cpp delete mode 100644 src/game/HostilRefManager.h create mode 100644 src/game/HostileRefManager.cpp create mode 100644 src/game/HostileRefManager.h diff --git a/src/game/BattleGround.cpp b/src/game/BattleGround.cpp index bde132835c0..caa9549be36 100644 --- a/src/game/BattleGround.cpp +++ b/src/game/BattleGround.cpp @@ -767,7 +767,7 @@ void BattleGround::EndBattleGround(uint32 winner) { //needed cause else in av some creatures will kill the players at the end plr->CombatStop(); - plr->getHostilRefManager().deleteReferences(); + plr->getHostileRefManager().deleteReferences(); } //this line is obsolete - team is set ALWAYS diff --git a/src/game/CMakeLists.txt b/src/game/CMakeLists.txt index 48229003687..8fa5dc1b66d 100644 --- a/src/game/CMakeLists.txt +++ b/src/game/CMakeLists.txt @@ -125,8 +125,8 @@ SET(game_STAT_SRCS GuildHandler.cpp HomeMovementGenerator.cpp HomeMovementGenerator.h - HostilRefManager.cpp - HostilRefManager.h + HostileRefManager.cpp + HostileRefManager.h IdleMovementGenerator.cpp IdleMovementGenerator.h InstanceData.cpp diff --git a/src/game/Chat.cpp b/src/game/Chat.cpp index b2ea766a360..d843643ad83 100644 --- a/src/game/Chat.cpp +++ b/src/game/Chat.cpp @@ -169,7 +169,7 @@ ChatCommand * ChatHandler::getCommandTable() { { "setbit", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugSet32Bit, "", NULL }, { "threat", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugThreatList, "", NULL }, - { "hostil", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugHostilRefList, "", NULL }, + { "hostil", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugHostileRefList, "", NULL }, { "anim", SEC_GAMEMASTER, false, &ChatHandler::HandleDebugAnimCommand, "", NULL }, { "arena", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugArenaCommand, "", NULL }, { "bg", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDebugBattlegroundCommand, "", NULL }, diff --git a/src/game/Chat.h b/src/game/Chat.h index 8ecef9bbcc2..92f7d9b87a4 100644 --- a/src/game/Chat.h +++ b/src/game/Chat.h @@ -162,7 +162,7 @@ class ChatHandler bool HandleDebugSet32Bit(const char* args); bool HandleDebugThreatList(const char * args); - bool HandleDebugHostilRefList(const char * args); + bool HandleDebugHostileRefList(const char * args); bool HandlePossessCommand(const char* args); bool HandleUnPossessCommand(const char* args); bool HandleBindSightCommand(const char* args); diff --git a/src/game/CombatAI.cpp b/src/game/CombatAI.cpp index a12f39fac1e..625fb1adcba 100644 --- a/src/game/CombatAI.cpp +++ b/src/game/CombatAI.cpp @@ -248,7 +248,7 @@ void TurretAI::UpdateAI(const uint32 diff) DoSpellAttackIfReady(me->m_spells[0]); //if(!DoSpellAttackIfReady(me->m_spells[0])) - //if(HostilReference *ref = me->getThreatManager().getCurrentVictim()) + //if(HostileReference *ref = me->getThreatManager().getCurrentVictim()) //ref->removeReference(); } diff --git a/src/game/CreatureEventAI.cpp b/src/game/CreatureEventAI.cpp index 6d3e0bf26a5..3b6281677f4 100644 --- a/src/game/CreatureEventAI.cpp +++ b/src/game/CreatureEventAI.cpp @@ -525,8 +525,8 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 break; case ACTION_T_THREAT_ALL_PCT: { - std::list& threatList = m_creature->getThreatManager().getThreatList(); - for (std::list::iterator i = threatList.begin(); i != threatList.end(); ++i) + std::list& threatList = m_creature->getThreatManager().getThreatList(); + for (std::list::iterator i = threatList.begin(); i != threatList.end(); ++i) if(Unit* Temp = Unit::GetUnit(*m_creature,(*i)->getUnitGuid())) m_creature->getThreatManager().modifyThreatPercent(Temp, action.threat_all_pct.percent); break; @@ -627,8 +627,8 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 break; case ACTION_T_CAST_EVENT_ALL: { - std::list& threatList = m_creature->getThreatManager().getThreatList(); - for (std::list::iterator i = threatList.begin(); i != threatList.end(); ++i) + std::list& threatList = m_creature->getThreatManager().getThreatList(); + for (std::list::iterator i = threatList.begin(); i != threatList.end(); ++i) if (Unit* Temp = Unit::GetUnit(*m_creature,(*i)->getUnitGuid())) if (Temp->GetTypeId() == TYPEID_PLAYER) Temp->ToPlayer()->CastedCreatureOrGO(action.cast_event_all.creatureId, m_creature->GetGUID(), action.cast_event_all.spellId); @@ -1105,9 +1105,9 @@ void CreatureEventAI::UpdateAI(const uint32 diff) inline Unit* CreatureEventAI::SelectUnit(AttackingTarget target, uint32 position) { //ThreatList m_threatlist; - std::list& m_threatlist = m_creature->getThreatManager().getThreatList(); - std::list::iterator i = m_threatlist.begin(); - std::list::reverse_iterator r = m_threatlist.rbegin(); + std::list& m_threatlist = m_creature->getThreatManager().getThreatList(); + std::list::iterator i = m_threatlist.begin(); + std::list::reverse_iterator r = m_threatlist.rbegin(); if (position >= m_threatlist.size() || !m_threatlist.size()) return NULL; diff --git a/src/game/Debugcmds.cpp b/src/game/Debugcmds.cpp index f93c8e22374..b5fc989bb61 100644 --- a/src/game/Debugcmds.cpp +++ b/src/game/Debugcmds.cpp @@ -665,8 +665,8 @@ bool ChatHandler::HandleDebugThreatList(const char * /*args*/) if(!target || target->isTotem() || target->isPet()) return false; - std::list& tlist = target->getThreatManager().getThreatList(); - std::list::iterator itr; + std::list& tlist = target->getThreatManager().getThreatList(); + std::list::iterator itr; uint32 cnt = 0; PSendSysMessage("Threat list of %s (guid %u)",target->GetName(), target->GetGUIDLow()); for (itr = tlist.begin(); itr != tlist.end(); ++itr) @@ -681,12 +681,12 @@ bool ChatHandler::HandleDebugThreatList(const char * /*args*/) return true; } -bool ChatHandler::HandleDebugHostilRefList(const char * /*args*/) +bool ChatHandler::HandleDebugHostileRefList(const char * /*args*/) { Unit* target = getSelectedUnit(); if(!target) target = m_session->GetPlayer(); - HostilReference* ref = target->getHostilRefManager().getFirst(); + HostileReference* ref = target->getHostileRefManager().getFirst(); uint32 cnt = 0; PSendSysMessage("Hostil reference list of %s (guid %u)",target->GetName(), target->GetGUIDLow()); while(ref) diff --git a/src/game/HostilRefManager.cpp b/src/game/HostilRefManager.cpp deleted file mode 100644 index 8da2e566d24..00000000000 --- a/src/game/HostilRefManager.cpp +++ /dev/null @@ -1,189 +0,0 @@ -/* - * Copyright (C) 2005-2009 MaNGOS - * - * Copyright (C) 2008-2010 Trinity - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "HostilRefManager.h" -#include "ThreatManager.h" -#include "Unit.h" -#include "DBCStructure.h" -#include "SpellMgr.h" - -HostilRefManager::~HostilRefManager() -{ - deleteReferences(); -} - -//================================================= -// send threat to all my hateres for the pVictim -// The pVictim is hated than by them as well -// use for buffs and healing threat functionality - -void HostilRefManager::threatAssist(Unit *pVictim, float fThreat, SpellEntry const *pThreatSpell, bool pSingleTarget) -{ - HostilReference* ref; - - float size = pSingleTarget ? 1.0f : getSize(); // if pSingleTarget do not divide threat - ref = getFirst(); - while(ref != NULL) - { - float threat = ThreatCalcHelper::calcThreat(pVictim, iOwner, fThreat, (pThreatSpell ? GetSpellSchoolMask(pThreatSpell) : SPELL_SCHOOL_MASK_NORMAL), pThreatSpell); - if(pVictim == getOwner()) - ref->addThreat(threat / size); // It is faster to modify the threat durectly if possible - else - ref->getSource()->addThreat(pVictim, threat / size); - ref = ref->next(); - } -} - -//================================================= - -void HostilRefManager::addTempThreat(float fThreat, bool apply) -{ - HostilReference* ref = getFirst(); - - while(ref != NULL) - { - if (apply) - { - if (ref->getTempThreatModifier() == 0.0f) - ref->addTempThreat(fThreat); - } - else - ref->resetTempThreat(); - - ref = ref->next(); - } -} - - -//================================================= - -void HostilRefManager::addThreatPercent(int32 iPercent) -{ - HostilReference* ref; - - ref = getFirst(); - while (ref != NULL) - { - ref->addThreatPercent(iPercent); - ref = ref->next(); - } -} - -//================================================= -// The online / offline status is given to the method. The calculation has to be done before - -void HostilRefManager::setOnlineOfflineState(bool bIsOnline) -{ - HostilReference* ref; - - ref = getFirst(); - while(ref != NULL) - { - ref->setOnlineOfflineState(bIsOnline); - ref = ref->next(); - } -} - -//================================================= -// The online / offline status is calculated and set - -void HostilRefManager::updateThreatTables() -{ - HostilReference* ref = getFirst(); - while(ref) - { - ref->updateOnlineStatus(); - ref = ref->next(); - } -} - -//================================================= -// The references are not needed anymore -// tell the source to remove them from the list and free the mem - -void HostilRefManager::deleteReferences() -{ - HostilReference* ref = getFirst(); - while(ref) - { - HostilReference* nextRef = ref->next(); - ref->removeReference(); - delete ref; - ref = nextRef; - } -} - -//================================================= -// delete one reference, defined by faction - -void HostilRefManager::deleteReferencesForFaction(uint32 faction) -{ - HostilReference* ref = getFirst(); - while(ref) - { - HostilReference* nextRef = ref->next(); - if(ref->getSource()->getOwner()->getFactionTemplateEntry()->faction == faction) - { - ref->removeReference(); - delete ref; - } - ref = nextRef; - } -} - -//================================================= -// delete one reference, defined by Unit - -void HostilRefManager::deleteReference(Unit *pCreature) -{ - HostilReference* ref = getFirst(); - while(ref) - { - HostilReference* nextRef = ref->next(); - if(ref->getSource()->getOwner() == pCreature) - { - ref->removeReference(); - delete ref; - break; - } - ref = nextRef; - } -} - -//================================================= -// set state for one reference, defined by Unit - -void HostilRefManager::setOnlineOfflineState(Unit *pCreature, bool bIsOnline) -{ - HostilReference* ref = getFirst(); - while(ref) - { - HostilReference* nextRef = ref->next(); - if(ref->getSource()->getOwner() == pCreature) - { - ref->setOnlineOfflineState(bIsOnline); - break; - } - ref = nextRef; - } -} - -//================================================= - diff --git a/src/game/HostilRefManager.h b/src/game/HostilRefManager.h deleted file mode 100644 index defaea1ea12..00000000000 --- a/src/game/HostilRefManager.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (C) 2005-2009 MaNGOS - * - * Copyright (C) 2008-2010 Trinity - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _HOSTILEREFMANAGER -#define _HOSTILEREFMANAGER - -#include "Common.h" -#include "Utilities/LinkedReference/RefManager.h" - -class Unit; -class ThreatManager; -class HostilReference; -struct SpellEntry; - -//================================================= - -class HostilRefManager : public RefManager -{ - private: - Unit *iOwner; - public: - explicit HostilRefManager(Unit *pOwner) { iOwner = pOwner; } - ~HostilRefManager(); - - Unit* getOwner() { return iOwner; } - - // send threat to all my hateres for the pVictim - // The pVictim is hated than by them as well - // use for buffs and healing threat functionality - void threatAssist(Unit *pVictim, float fThreat, SpellEntry const *threatSpell = 0, bool pSingleTarget = false); - - void addTempThreat(float fThreat, bool apply); - - void addThreatPercent(int32 iPercent); - - // The references are not needed anymore - // tell the source to remove them from the list and free the mem - void deleteReferences(); - - // Remove specific faction references - void deleteReferencesForFaction(uint32 faction); - - HostilReference* getFirst() { return ((HostilReference* ) RefManager::getFirst()); } - - void updateThreatTables(); - - void setOnlineOfflineState(bool bIsOnline); - - // set state for one reference, defined by Unit - void setOnlineOfflineState(Unit *pCreature, bool bIsOnline); - - // delete one reference, defined by Unit - void deleteReference(Unit *pCreature); -}; -//================================================= -#endif - diff --git a/src/game/HostileRefManager.cpp b/src/game/HostileRefManager.cpp new file mode 100644 index 00000000000..efcc544c69f --- /dev/null +++ b/src/game/HostileRefManager.cpp @@ -0,0 +1,189 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * Copyright (C) 2008-2010 Trinity + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "HostileRefManager.h" +#include "ThreatManager.h" +#include "Unit.h" +#include "DBCStructure.h" +#include "SpellMgr.h" + +HostileRefManager::~HostileRefManager() +{ + deleteReferences(); +} + +//================================================= +// send threat to all my hateres for the pVictim +// The pVictim is hated than by them as well +// use for buffs and healing threat functionality + +void HostileRefManager::threatAssist(Unit *pVictim, float fThreat, SpellEntry const *pThreatSpell, bool pSingleTarget) +{ + HostileReference* ref; + + float size = pSingleTarget ? 1.0f : getSize(); // if pSingleTarget do not divide threat + ref = getFirst(); + while(ref != NULL) + { + float threat = ThreatCalcHelper::calcThreat(pVictim, iOwner, fThreat, (pThreatSpell ? GetSpellSchoolMask(pThreatSpell) : SPELL_SCHOOL_MASK_NORMAL), pThreatSpell); + if(pVictim == getOwner()) + ref->addThreat(threat / size); // It is faster to modify the threat durectly if possible + else + ref->getSource()->addThreat(pVictim, threat / size); + ref = ref->next(); + } +} + +//================================================= + +void HostileRefManager::addTempThreat(float fThreat, bool apply) +{ + HostileReference* ref = getFirst(); + + while(ref != NULL) + { + if (apply) + { + if (ref->getTempThreatModifier() == 0.0f) + ref->addTempThreat(fThreat); + } + else + ref->resetTempThreat(); + + ref = ref->next(); + } +} + + +//================================================= + +void HostileRefManager::addThreatPercent(int32 iPercent) +{ + HostileReference* ref; + + ref = getFirst(); + while (ref != NULL) + { + ref->addThreatPercent(iPercent); + ref = ref->next(); + } +} + +//================================================= +// The online / offline status is given to the method. The calculation has to be done before + +void HostileRefManager::setOnlineOfflineState(bool bIsOnline) +{ + HostileReference* ref; + + ref = getFirst(); + while(ref != NULL) + { + ref->setOnlineOfflineState(bIsOnline); + ref = ref->next(); + } +} + +//================================================= +// The online / offline status is calculated and set + +void HostileRefManager::updateThreatTables() +{ + HostileReference* ref = getFirst(); + while(ref) + { + ref->updateOnlineStatus(); + ref = ref->next(); + } +} + +//================================================= +// The references are not needed anymore +// tell the source to remove them from the list and free the mem + +void HostileRefManager::deleteReferences() +{ + HostileReference* ref = getFirst(); + while(ref) + { + HostileReference* nextRef = ref->next(); + ref->removeReference(); + delete ref; + ref = nextRef; + } +} + +//================================================= +// delete one reference, defined by faction + +void HostileRefManager::deleteReferencesForFaction(uint32 faction) +{ + HostileReference* ref = getFirst(); + while(ref) + { + HostileReference* nextRef = ref->next(); + if(ref->getSource()->getOwner()->getFactionTemplateEntry()->faction == faction) + { + ref->removeReference(); + delete ref; + } + ref = nextRef; + } +} + +//================================================= +// delete one reference, defined by Unit + +void HostileRefManager::deleteReference(Unit *pCreature) +{ + HostileReference* ref = getFirst(); + while(ref) + { + HostileReference* nextRef = ref->next(); + if(ref->getSource()->getOwner() == pCreature) + { + ref->removeReference(); + delete ref; + break; + } + ref = nextRef; + } +} + +//================================================= +// set state for one reference, defined by Unit + +void HostileRefManager::setOnlineOfflineState(Unit *pCreature, bool bIsOnline) +{ + HostileReference* ref = getFirst(); + while(ref) + { + HostileReference* nextRef = ref->next(); + if(ref->getSource()->getOwner() == pCreature) + { + ref->setOnlineOfflineState(bIsOnline); + break; + } + ref = nextRef; + } +} + +//================================================= + diff --git a/src/game/HostileRefManager.h b/src/game/HostileRefManager.h new file mode 100644 index 00000000000..385accb233b --- /dev/null +++ b/src/game/HostileRefManager.h @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2005-2009 MaNGOS + * + * Copyright (C) 2008-2010 Trinity + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _HOSTILEREFMANAGER +#define _HOSTILEREFMANAGER + +#include "Common.h" +#include "Utilities/LinkedReference/RefManager.h" + +class Unit; +class ThreatManager; +class HostileReference; +struct SpellEntry; + +//================================================= + +class HostileRefManager : public RefManager +{ + private: + Unit *iOwner; + public: + explicit HostileRefManager(Unit *pOwner) { iOwner = pOwner; } + ~HostileRefManager(); + + Unit* getOwner() { return iOwner; } + + // send threat to all my hateres for the pVictim + // The pVictim is hated than by them as well + // use for buffs and healing threat functionality + void threatAssist(Unit *pVictim, float fThreat, SpellEntry const *threatSpell = 0, bool pSingleTarget = false); + + void addTempThreat(float fThreat, bool apply); + + void addThreatPercent(int32 iPercent); + + // The references are not needed anymore + // tell the source to remove them from the list and free the mem + void deleteReferences(); + + // Remove specific faction references + void deleteReferencesForFaction(uint32 faction); + + HostileReference* getFirst() { return ((HostileReference* ) RefManager::getFirst()); } + + void updateThreatTables(); + + void setOnlineOfflineState(bool bIsOnline); + + // set state for one reference, defined by Unit + void setOnlineOfflineState(Unit *pCreature, bool bIsOnline); + + // delete one reference, defined by Unit + void deleteReference(Unit *pCreature); +}; +//================================================= +#endif + diff --git a/src/game/Level2.cpp b/src/game/Level2.cpp index 003a42cc506..74a3b5b935e 100644 --- a/src/game/Level2.cpp +++ b/src/game/Level2.cpp @@ -3596,7 +3596,7 @@ bool ChatHandler::HandleCombatStopCommand(const char* args) return false; target->CombatStop(); - target->getHostilRefManager().deleteReferences(); + target->getHostileRefManager().deleteReferences(); return true; } diff --git a/src/game/OutdoorPvPWG.cpp b/src/game/OutdoorPvPWG.cpp index 4d4c6590b04..018bcaa556d 100644 --- a/src/game/OutdoorPvPWG.cpp +++ b/src/game/OutdoorPvPWG.cpp @@ -924,7 +924,7 @@ bool OutdoorPvPWG::UpdateQuestGiverPosition(uint32 guid, Creature *creature) if (creature->isAlive() && creature->isInCombat()) { creature->CombatStop(true); - creature->getHostilRefManager().deleteReferences(); + creature->getHostileRefManager().deleteReferences(); } creature->SetHomePosition(pos); creature->DestroyForNearbyPlayers(); @@ -1456,7 +1456,7 @@ void OutdoorPvPWG::EndBattle() } (*itr)->RemoveAurasDueToSpell(SPELL_TENACITY); (*itr)->CombatStop(true); - (*itr)->getHostilRefManager().deleteReferences(); + (*itr)->getHostileRefManager().deleteReferences(); } if (m_timer == 1) // Battle End was forced so no reward. diff --git a/src/game/PetAI.cpp b/src/game/PetAI.cpp index 44571216aff..557ff5ee66c 100644 --- a/src/game/PetAI.cpp +++ b/src/game/PetAI.cpp @@ -65,7 +65,7 @@ void PetAI::_stopAttack() m_creature->GetMotionMaster()->Clear(); m_creature->GetMotionMaster()->MoveIdle(); m_creature->CombatStop(); - m_creature->getHostilRefManager().deleteReferences(); + m_creature->getHostileRefManager().deleteReferences(); return; } diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 85dee7861d9..c1accd063df 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -2323,7 +2323,7 @@ void Player::SetInWater(bool apply) // remove auras that need water/land RemoveAurasWithInterruptFlags(apply ? AURA_INTERRUPT_FLAG_NOT_ABOVEWATER : AURA_INTERRUPT_FLAG_NOT_UNDERWATER); - getHostilRefManager().updateThreatTables(); + getHostileRefManager().updateThreatTables(); } void Player::SetGameMaster(bool on) @@ -2337,13 +2337,13 @@ void Player::SetGameMaster(bool on) if (Pet* pet = GetPet()) { pet->setFaction(35); - pet->getHostilRefManager().setOnlineOfflineState(false); + pet->getHostileRefManager().setOnlineOfflineState(false); } RemoveByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP); ResetContestedPvP(); - getHostilRefManager().setOnlineOfflineState(false); + getHostileRefManager().setOnlineOfflineState(false); CombatStopWithPets(); SetPhaseMask(PHASEMASK_ANYWHERE,false); // see and visible in all phases @@ -2361,7 +2361,7 @@ void Player::SetGameMaster(bool on) if (Pet* pet = GetPet()) { pet->setFaction(getFaction()); - pet->getHostilRefManager().setOnlineOfflineState(true); + pet->getHostileRefManager().setOnlineOfflineState(true); } // restore FFA PvP Server state @@ -2371,7 +2371,7 @@ void Player::SetGameMaster(bool on) // restore FFA PvP area state, remove not allowed for GM mounts UpdateArea(m_areaUpdateId); - getHostilRefManager().setOnlineOfflineState(true); + getHostileRefManager().setOnlineOfflineState(true); } UpdateObjectVisibility(); @@ -18909,7 +18909,7 @@ void Player::CleanupAfterTaxiFlight() m_taxi.ClearTaxiDestinations(); // not destinations, clear source node Unmount(); RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_TAXI_FLIGHT); - getHostilRefManager().setOnlineOfflineState(true); + getHostileRefManager().setOnlineOfflineState(true); } void Player::ContinueTaxiFlight() diff --git a/src/game/ScriptedCreature.cpp b/src/game/ScriptedCreature.cpp index 8078d543cb9..19d8afa02ff 100644 --- a/src/game/ScriptedCreature.cpp +++ b/src/game/ScriptedCreature.cpp @@ -168,9 +168,9 @@ Creature* ScriptedAI::DoSpawnCreature(uint32 uiId, float fX, float fY, float fZ, Unit* ScriptedAI::SelectUnit(SelectAggroTarget pTarget, uint32 uiPosition) { //ThreatList m_threatlist; - std::list& threatlist = m_creature->getThreatManager().getThreatList(); - std::list::iterator itr = threatlist.begin(); - std::list::reverse_iterator ritr = threatlist.rbegin(); + std::list& threatlist = m_creature->getThreatManager().getThreatList(); + std::list::iterator itr = threatlist.begin(); + std::list::reverse_iterator ritr = threatlist.rbegin(); if (uiPosition >= threatlist.size() || !threatlist.size()) return NULL; @@ -401,9 +401,9 @@ void ScriptedAI::DoResetThreat() return; } - std::list& threatlist = m_creature->getThreatManager().getThreatList(); + std::list& threatlist = m_creature->getThreatManager().getThreatList(); - for (std::list::iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr) + for (std::list::iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr) { Unit* pUnit = Unit::GetUnit((*m_creature), (*itr)->getUnitGuid()); @@ -636,8 +636,8 @@ void BossAI::TeleportCheaters() { float x, y, z; me->GetPosition(x, y, z); - std::list &m_threatlist = me->getThreatManager().getThreatList(); - for (std::list::iterator itr = m_threatlist.begin(); itr != m_threatlist.end(); ++itr) + std::list &m_threatlist = me->getThreatManager().getThreatList(); + for (std::list::iterator itr = m_threatlist.begin(); itr != m_threatlist.end(); ++itr) if((*itr)->getTarget()->GetTypeId() == TYPEID_PLAYER && !CheckBoundary((*itr)->getTarget())) (*itr)->getTarget()->NearTeleportTo(x, y, z, 0); } diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index edf53a56b49..f0c5acc48eb 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -1160,7 +1160,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target) caster->ProcDamageAndSpell(unitTarget, procAttacker, procVictim, procEx, addhealth, m_attackType, m_spellInfo, m_triggeredByAuraSpell); int32 gain = caster->DealHeal(unitTarget, addhealth, m_spellInfo, crit); - unitTarget->getHostilRefManager().threatAssist(caster, float(gain) * 0.5f, m_spellInfo); + unitTarget->getHostileRefManager().threatAssist(caster, float(gain) * 0.5f, m_spellInfo); } // Do damage and triggers else if (m_damage > 0) @@ -1325,7 +1325,7 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask, bool if( unit->isInCombat() && !(m_spellInfo->AttributesEx3 & SPELL_ATTR_EX3_NO_INITIAL_AGGRO) ) { m_caster->SetInCombatState(unit->GetCombatTimer() > 0, unit); - unit->getHostilRefManager().threatAssist(m_caster, 0.0f); + unit->getHostileRefManager().threatAssist(m_caster, 0.0f); } } } diff --git a/src/game/SpellAuraEffects.cpp b/src/game/SpellAuraEffects.cpp index 7d2f1b343e0..5ea6a776ea3 100644 --- a/src/game/SpellAuraEffects.cpp +++ b/src/game/SpellAuraEffects.cpp @@ -1395,7 +1395,7 @@ void AuraEffect::PeriodicTick(Unit * target, Unit * caster) const uint32 heal = uint32(caster->SpellHealingBonus(caster, GetSpellProto(), uint32(new_damage * multiplier), DOT, GetBase()->GetStackAmount())); int32 gain = caster->DealHeal(caster, heal, GetSpellProto()); - caster->getHostilRefManager().threatAssist(caster, gain * 0.5f, GetSpellProto()); + caster->getHostileRefManager().threatAssist(caster, gain * 0.5f, GetSpellProto()); break; } case SPELL_AURA_PERIODIC_HEALTH_FUNNEL: // only three spells @@ -1470,7 +1470,7 @@ void AuraEffect::PeriodicTick(Unit * target, Unit * caster) const if( BattleGround *bg = caster->ToPlayer()->GetBattleGround() ) bg->UpdatePlayerScore(caster->ToPlayer(), SCORE_HEALING_DONE, gain); - target->getHostilRefManager().threatAssist(caster, float(gain) * 0.5f, GetSpellProto()); + target->getHostileRefManager().threatAssist(caster, float(gain) * 0.5f, GetSpellProto()); bool haveCastItem = GetBase()->GetCastItemGUID() != 0; @@ -1631,7 +1631,7 @@ void AuraEffect::PeriodicTick(Unit * target, Unit * caster) const int32 gain = target->ModifyPower(power,amount); if(caster) - target->getHostilRefManager().threatAssist(caster, float(gain) * 0.5f, GetSpellProto()); + target->getHostileRefManager().threatAssist(caster, float(gain) * 0.5f, GetSpellProto()); break; } case SPELL_AURA_PERIODIC_ENERGIZE: @@ -1659,7 +1659,7 @@ void AuraEffect::PeriodicTick(Unit * target, Unit * caster) const int32 gain = target->ModifyPower(power,amount); if(caster) - target->getHostilRefManager().threatAssist(caster, float(gain) * 0.5f, GetSpellProto()); + target->getHostileRefManager().threatAssist(caster, float(gain) * 0.5f, GetSpellProto()); break; } case SPELL_AURA_POWER_BURN_MANA: @@ -3189,7 +3189,7 @@ void AuraEffect::HandleFeignDeath(AuraApplication const * aurApp, uint8 mode, bo if(GetCasterGUID()==target->GetGUID() && target->GetCurrentSpell(CURRENT_GENERIC_SPELL)) target->FinishSpell(CURRENT_GENERIC_SPELL, false); target->InterruptNonMeleeSpells(true); - target->getHostilRefManager().deleteReferences(); + target->getHostileRefManager().deleteReferences(); } else { @@ -3727,7 +3727,7 @@ void AuraEffect::HandleAuraModTotalThreat(AuraApplication const * aurApp, uint8 if (!caster || !caster->isAlive()) return; - target->getHostilRefManager().addTempThreat(GetAmount(), apply); + target->getHostileRefManager().addTempThreat(GetAmount(), apply); } void AuraEffect::HandleModTaunt(AuraApplication const * aurApp, uint8 mode, bool apply) const diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 523ca6691ab..9a19e1ac8cd 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -2909,7 +2909,7 @@ void Spell::EffectHealPct( uint32 /*i*/ ) // modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_DAMAGE, addhealth, this); int32 gain = caster->DealHeal(unitTarget, addhealth, m_spellInfo); - unitTarget->getHostilRefManager().threatAssist(m_caster, float(gain) * 0.5f, m_spellInfo); + unitTarget->getHostileRefManager().threatAssist(m_caster, float(gain) * 0.5f, m_spellInfo); } } @@ -4441,7 +4441,7 @@ void Spell::EffectTaunt(uint32 /*i*/) //Set aggro victim to caster if (!unitTarget->getThreatManager().getOnlineContainer().empty()) - if (HostilReference* forcedVictim = unitTarget->getThreatManager().getOnlineContainer().getReferenceByTarget(m_caster)) + if (HostileReference* forcedVictim = unitTarget->getThreatManager().getOnlineContainer().getReferenceByTarget(m_caster)) unitTarget->getThreatManager().setCurrentVictim(forcedVictim); if (unitTarget->ToCreature()->IsAIEnabled && !unitTarget->ToCreature()->HasReactState(REACT_PASSIVE)) @@ -6146,7 +6146,7 @@ void Spell::EffectSanctuary(uint32 /*i*/) } unitTarget->CombatStop(); - unitTarget->getHostilRefManager().deleteReferences(); // stop all fighting + unitTarget->getHostileRefManager().deleteReferences(); // stop all fighting // Vanish allows to remove all threat and cast regular stealth so other spells can be used if(m_caster->GetTypeId() == TYPEID_PLAYER && m_spellInfo->SpellFamilyName == SPELLFAMILY_ROGUE diff --git a/src/game/ThreatManager.cpp b/src/game/ThreatManager.cpp index 02665d9b55f..5d4979479d5 100644 --- a/src/game/ThreatManager.cpp +++ b/src/game/ThreatManager.cpp @@ -42,10 +42,10 @@ float ThreatCalcHelper::calcThreat(Unit* pHatedUnit, Unit* pHatingUnit, float fT } //============================================================ -//================= HostilReference ========================== +//================= HostileReference ========================== //============================================================ -HostilReference::HostilReference(Unit* pUnit, ThreatManager *pThreatManager, float fThreat) +HostileReference::HostileReference(Unit* pUnit, ThreatManager *pThreatManager, float fThreat) { iThreat = fThreat; iTempThreatModifier = 0.0f; @@ -57,14 +57,14 @@ HostilReference::HostilReference(Unit* pUnit, ThreatManager *pThreatManager, flo //============================================================ // Tell our refTo (target) object that we have a link -void HostilReference::targetObjectBuildLink() +void HostileReference::targetObjectBuildLink() { getTarget()->addHatedBy(this); } //============================================================ // Tell our refTo (taget) object, that the link is cut -void HostilReference::targetObjectDestroyLink() +void HostileReference::targetObjectDestroyLink() { getTarget()->removeHatedBy(this); } @@ -72,7 +72,7 @@ void HostilReference::targetObjectDestroyLink() //============================================================ // Tell our refFrom (source) object, that the link is cut (Target destroyed) -void HostilReference::sourceObjectDestroyLink() +void HostileReference::sourceObjectDestroyLink() { setOnlineOfflineState(false); } @@ -80,7 +80,7 @@ void HostilReference::sourceObjectDestroyLink() //============================================================ // Inform the source, that the status of the reference changed -void HostilReference::fireStatusChanged(ThreatRefStatusChangeEvent& pThreatRefStatusChangeEvent) +void HostileReference::fireStatusChanged(ThreatRefStatusChangeEvent& pThreatRefStatusChangeEvent) { if (getSource()) getSource()->processThreatEvent(&pThreatRefStatusChangeEvent); @@ -88,7 +88,7 @@ void HostilReference::fireStatusChanged(ThreatRefStatusChangeEvent& pThreatRefSt //============================================================ -void HostilReference::addThreat(float fModThreat) +void HostileReference::addThreat(float fModThreat) { iThreat += fModThreat; // the threat is changed. Source and target unit have to be available @@ -112,7 +112,7 @@ void HostilReference::addThreat(float fModThreat) //============================================================ // check, if source can reach target and set the status -void HostilReference::updateOnlineStatus() +void HostileReference::updateOnlineStatus() { bool online = false; bool accessible = false; @@ -147,7 +147,7 @@ void HostilReference::updateOnlineStatus() //============================================================ // set the status and fire the event on status change -void HostilReference::setOnlineOfflineState(bool pIsOnline) +void HostileReference::setOnlineOfflineState(bool pIsOnline) { if (iOnline != pIsOnline) { @@ -162,7 +162,7 @@ void HostilReference::setOnlineOfflineState(bool pIsOnline) //============================================================ -void HostilReference::setAccessibleState(bool pIsAccessible) +void HostileReference::setAccessibleState(bool pIsAccessible) { if (iAccessible != pIsAccessible) { @@ -177,7 +177,7 @@ void HostilReference::setAccessibleState(bool pIsAccessible) // prepare the reference for deleting // this is called be the target -void HostilReference::removeReference() +void HostileReference::removeReference() { invalidate(); @@ -187,7 +187,7 @@ void HostilReference::removeReference() //============================================================ -Unit* HostilReference::getSourceUnit() +Unit* HostileReference::getSourceUnit() { return (getSource()->getOwner()); } @@ -198,7 +198,7 @@ Unit* HostilReference::getSourceUnit() void ThreatContainer::clearReferences() { - for (std::list::const_iterator i = iThreatList.begin(); i != iThreatList.end(); ++i) + for (std::list::const_iterator i = iThreatList.begin(); i != iThreatList.end(); ++i) { (*i)->unlink(); delete (*i); @@ -207,13 +207,13 @@ void ThreatContainer::clearReferences() } //============================================================ -// Return the HostilReference of NULL, if not found -HostilReference* ThreatContainer::getReferenceByTarget(Unit* pVictim) +// Return the HostileReference of NULL, if not found +HostileReference* ThreatContainer::getReferenceByTarget(Unit* pVictim) { - HostilReference* result = NULL; + HostileReference* result = NULL; uint64 guid = pVictim->GetGUID(); - for (std::list::const_iterator i = iThreatList.begin(); i != iThreatList.end(); ++i) + for (std::list::const_iterator i = iThreatList.begin(); i != iThreatList.end(); ++i) { if((*i)->getUnitGuid() == guid) { @@ -228,9 +228,9 @@ HostilReference* ThreatContainer::getReferenceByTarget(Unit* pVictim) //============================================================ // Add the threat, if we find the reference -HostilReference* ThreatContainer::addThreat(Unit* pVictim, float fThreat) +HostileReference* ThreatContainer::addThreat(Unit* pVictim, float fThreat) { - HostilReference* ref = getReferenceByTarget(pVictim); + HostileReference* ref = getReferenceByTarget(pVictim); if (ref) ref->addThreat(fThreat); return ref; @@ -240,13 +240,13 @@ HostilReference* ThreatContainer::addThreat(Unit* pVictim, float fThreat) void ThreatContainer::modifyThreatPercent(Unit *pVictim, int32 iPercent) { - if(HostilReference* ref = getReferenceByTarget(pVictim)) + if(HostileReference* ref = getReferenceByTarget(pVictim)) ref->addThreatPercent(iPercent); } //============================================================ -bool HostilReferenceSortPredicate(const HostilReference* lhs, const HostilReference* rhs) +bool HostileReferenceSortPredicate(const HostileReference* lhs, const HostileReference* rhs) { // std::list::sort ordering predicate must be: (Pred(x,y)&&Pred(y,x))==false return lhs->getThreat() > rhs->getThreat(); // reverse sorting @@ -259,7 +259,7 @@ void ThreatContainer::update() { if(iDirty && iThreatList.size() >1) { - iThreatList.sort(HostilReferenceSortPredicate); + iThreatList.sort(HostileReferenceSortPredicate); } iDirty = false; } @@ -268,16 +268,16 @@ void ThreatContainer::update() // return the next best victim // could be the current victim -HostilReference* ThreatContainer::selectNextVictim(Creature* pAttacker, HostilReference* pCurrentVictim) +HostileReference* ThreatContainer::selectNextVictim(Creature* pAttacker, HostileReference* pCurrentVictim) { - HostilReference* currentRef = NULL; + HostileReference* currentRef = NULL; bool found = false; bool noPriorityTargetFound = false; - std::list::const_iterator lastRef = iThreatList.end(); + std::list::const_iterator lastRef = iThreatList.end(); lastRef--; - for (std::list::const_iterator iter = iThreatList.begin(); iter != iThreatList.end() && !found;) + for (std::list::const_iterator iter = iThreatList.begin(); iter != iThreatList.end() && !found;) { currentRef = (*iter); @@ -395,7 +395,7 @@ void ThreatManager::addThreat(Unit* pVictim, float fThreat, SpellSchoolMask scho void ThreatManager::_addThreat(Unit *pVictim, float fThreat) { - HostilReference* ref = iThreatContainer.addThreat(pVictim, fThreat); + HostileReference* ref = iThreatContainer.addThreat(pVictim, fThreat); // Ref is not in the online refs, search the offline refs next if (!ref) ref = iThreatOfflineContainer.addThreat(pVictim, fThreat); @@ -403,7 +403,7 @@ void ThreatManager::_addThreat(Unit *pVictim, float fThreat) if (!ref) // there was no ref => create a new one { // threat has to be 0 here - HostilReference* hostilReference = new HostilReference(pVictim, this, 0); + HostileReference* hostilReference = new HostileReference(pVictim, this, 0); iThreatContainer.addReference(hostilReference); hostilReference->addThreat(fThreat); // now we add the real threat if(pVictim->GetTypeId() == TYPEID_PLAYER && pVictim->ToPlayer()->isGameMaster()) @@ -423,7 +423,7 @@ void ThreatManager::modifyThreatPercent(Unit *pVictim, int32 iPercent) Unit* ThreatManager::getHostilTarget() { iThreatContainer.update(); - HostilReference* nextVictim = iThreatContainer.selectNextVictim( getOwner()->ToCreature(), getCurrentVictim()); + HostileReference* nextVictim = iThreatContainer.selectNextVictim( getOwner()->ToCreature(), getCurrentVictim()); setCurrentVictim(nextVictim); return getCurrentVictim() != NULL ? getCurrentVictim()->getTarget() : NULL; } @@ -433,7 +433,7 @@ Unit* ThreatManager::getHostilTarget() float ThreatManager::getThreat(Unit *pVictim, bool pAlsoSearchOfflineList) { float threat = 0.0f; - HostilReference* ref = iThreatContainer.getReferenceByTarget(pVictim); + HostileReference* ref = iThreatContainer.getReferenceByTarget(pVictim); if(!ref && pAlsoSearchOfflineList) ref = iThreatOfflineContainer.getReferenceByTarget(pVictim); if(ref) @@ -445,7 +445,7 @@ float ThreatManager::getThreat(Unit *pVictim, bool pAlsoSearchOfflineList) void ThreatManager::tauntApply(Unit* pTaunter) { - HostilReference* ref = iThreatContainer.getReferenceByTarget(pTaunter); + HostileReference* ref = iThreatContainer.getReferenceByTarget(pTaunter); if(getCurrentVictim() && ref && (ref->getThreat() < getCurrentVictim()->getThreat())) { if(ref->getTempThreatModifier() == 0.0f) // Ok, temp threat is unused @@ -457,20 +457,20 @@ void ThreatManager::tauntApply(Unit* pTaunter) void ThreatManager::tauntFadeOut(Unit *pTaunter) { - HostilReference* ref = iThreatContainer.getReferenceByTarget(pTaunter); + HostileReference* ref = iThreatContainer.getReferenceByTarget(pTaunter); if(ref) ref->resetTempThreat(); } //============================================================ -void ThreatManager::setCurrentVictim(HostilReference* pHostilReference) +void ThreatManager::setCurrentVictim(HostileReference* pHostileReference) { - if (pHostilReference && pHostilReference != iCurrentVictim) + if (pHostileReference && pHostileReference != iCurrentVictim) { - iOwner->SendChangeCurrentVictimOpcode(pHostilReference); + iOwner->SendChangeCurrentVictimOpcode(pHostileReference); } - iCurrentVictim = pHostilReference; + iCurrentVictim = pHostileReference; } //============================================================ @@ -481,7 +481,7 @@ void ThreatManager::processThreatEvent(ThreatRefStatusChangeEvent* threatRefStat { threatRefStatusChangeEvent->setThreatManager(this); // now we can set the threat manager - HostilReference* hostilReference = threatRefStatusChangeEvent->getReference(); + HostileReference* hostilReference = threatRefStatusChangeEvent->getReference(); switch(threatRefStatusChangeEvent->getType()) { @@ -540,11 +540,11 @@ bool ThreatManager::isNeedUpdateToClient(uint32 time) // Reset all aggro without modifying the threadlist. void ThreatManager::resetAllAggro() { - std::list &threatlist = getThreatList(); + std::list &threatlist = getThreatList(); if (threatlist.empty()) return; - for (std::list::iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr) + for (std::list::iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr) { (*itr)->setThreat(0); } diff --git a/src/game/ThreatManager.h b/src/game/ThreatManager.h index e7e51ad40d7..d1635ae4372 100644 --- a/src/game/ThreatManager.h +++ b/src/game/ThreatManager.h @@ -47,10 +47,10 @@ class ThreatCalcHelper }; //============================================================== -class HostilReference : public Reference +class HostileReference : public Reference { public: - HostilReference(Unit* pUnit, ThreatManager *pThreatManager, float fThreat); + HostileReference(Unit* pUnit, ThreatManager *pThreatManager, float fThreat); //================================================= void addThreat(float fModThreat); @@ -106,7 +106,7 @@ class HostilReference : public Reference void setAccessibleState(bool pIsAccessible); //================================================= - bool operator ==(const HostilReference& pHostilReference) const { return pHostilReference.getUnitGuid() == getUnitGuid(); } + bool operator ==(const HostileReference& pHostileReference) const { return pHostileReference.getUnitGuid() == getUnitGuid(); } //================================================= @@ -119,7 +119,7 @@ class HostilReference : public Reference //================================================= - HostilReference* next() { return ((HostilReference* ) Reference::next()); } + HostileReference* next() { return ((HostileReference* ) Reference::next()); } //================================================= @@ -150,13 +150,13 @@ class ThreatManager; class ThreatContainer { private: - std::list iThreatList; + std::list iThreatList; bool iDirty; protected: friend class ThreatManager; - void remove(HostilReference* pRef) { iThreatList.remove(pRef); } - void addReference(HostilReference* pHostilReference) { iThreatList.push_back(pHostilReference); } + void remove(HostileReference* pRef) { iThreatList.remove(pRef); } + void addReference(HostileReference* pHostileReference) { iThreatList.push_back(pHostileReference); } void clearReferences(); // Sort the list if necessary void update(); @@ -164,11 +164,11 @@ class ThreatContainer ThreatContainer() { iDirty = false; } ~ThreatContainer() { clearReferences(); } - HostilReference* addThreat(Unit* pVictim, float fThreat); + HostileReference* addThreat(Unit* pVictim, float fThreat); void modifyThreatPercent(Unit *pVictim, int32 iPercent); - HostilReference* selectNextVictim(Creature* pAttacker, HostilReference* pCurrentVictim); + HostileReference* selectNextVictim(Creature* pAttacker, HostileReference* pCurrentVictim); void setDirty(bool pDirty) { iDirty = pDirty; } @@ -176,11 +176,11 @@ class ThreatContainer bool empty() { return(iThreatList.empty()); } - HostilReference* getMostHated() { return iThreatList.empty() ? NULL : iThreatList.front(); } + HostileReference* getMostHated() { return iThreatList.empty() ? NULL : iThreatList.front(); } - HostilReference* getReferenceByTarget(Unit* pVictim); + HostileReference* getReferenceByTarget(Unit* pVictim); - std::list& getThreatList() { return iThreatList; } + std::list& getThreatList() { return iThreatList; } }; //================================================= @@ -188,7 +188,7 @@ class ThreatContainer class ThreatManager { public: - friend class HostilReference; + friend class HostileReference; explicit ThreatManager(Unit *pOwner); @@ -207,7 +207,7 @@ class ThreatManager bool isNeedUpdateToClient(uint32 time); - HostilReference* getCurrentVictim() { return iCurrentVictim; } + HostileReference* getCurrentVictim() { return iCurrentVictim; } Unit* getOwner() { return iOwner; } @@ -216,7 +216,7 @@ class ThreatManager void tauntApply(Unit* pTaunter); void tauntFadeOut(Unit *pTaunter); - void setCurrentVictim(HostilReference* pHostilReference); + void setCurrentVictim(HostileReference* pHostileReference); void setDirty(bool bDirty) { iThreatContainer.setDirty(bDirty); } @@ -226,13 +226,13 @@ class ThreatManager // Reset all aggro of unit in threadlist satisfying the predicate. template void resetAggro(PREDICATE predicate) { - std::list &threatlist = getThreatList(); + std::list &threatlist = getThreatList(); if (threatlist.empty()) return; - for (std::list::iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr) + for (std::list::iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr) { - HostilReference* ref = (*itr); + HostileReference* ref = (*itr); if (predicate(ref->getTarget())) { @@ -244,14 +244,14 @@ class ThreatManager // methods to access the lists from the outside to do some dirty manipulation (scriping and such) // I hope they are used as little as possible. - std::list& getThreatList() { return iThreatContainer.getThreatList(); } - std::list& getOfflieThreatList() { return iThreatOfflineContainer.getThreatList(); } + std::list& getThreatList() { return iThreatContainer.getThreatList(); } + std::list& getOfflieThreatList() { return iThreatOfflineContainer.getThreatList(); } ThreatContainer& getOnlineContainer() { return iThreatContainer; } ThreatContainer& getOfflineContainer() { return iThreatOfflineContainer; } private: void _addThreat(Unit *pVictim, float fThreat); - HostilReference* iCurrentVictim; + HostileReference* iCurrentVictim; Unit* iOwner; uint32 iUpdateTimer; ThreatContainer iThreatContainer; diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 709ec8619db..3e75a6409f0 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -91,7 +91,7 @@ static bool isNonTriggerAura[TOTAL_AURAS]; static bool procPrepared = InitTriggerAuraData(); Unit::Unit() -: WorldObject(), i_motionMaster(this), m_ThreatManager(this), m_HostilRefManager(this) +: WorldObject(), i_motionMaster(this), m_ThreatManager(this), m_HostileRefManager(this) , IsAIEnabled(false), NeedChangeAI(false) , i_AI(NULL), i_disabledAI(NULL), m_removedAurasCount(0), m_vehicle(NULL), m_transport(NULL) , m_ControlledByPlayer(false), m_procDeep(0), m_unitTypeMask(UNIT_MASK_NONE), m_vehicleKit(NULL) @@ -246,7 +246,7 @@ void Unit::Update(uint32 p_time) // Check UNIT_STAT_MELEE_ATTACKING or UNIT_STAT_CHASE (without UNIT_STAT_FOLLOW in this case) so pets can reach far away // targets without stopping half way there and running off. // These flags are reset after target dies or another command is given. - if (m_HostilRefManager.isEmpty()) + if (m_HostileRefManager.isEmpty()) { // m_CombatTimer set at aura start and it will be freeze until aura removing if (m_CombatTimer <= p_time) @@ -11984,7 +11984,7 @@ void Unit::setDeathState(DeathState s) { CombatStop(); DeleteThreatList(); - getHostilRefManager().deleteReferences(); + getHostileRefManager().deleteReferences(); ClearComboPointHolders(); // any combo points pointed to unit lost at it death if (IsNonMeleeSpellCasted(false)) @@ -13108,7 +13108,7 @@ void Unit::CleanupsBeforeDelete(bool finalCleanup) CombatStop(); ClearComboPointHolders(); DeleteThreatList(); - getHostilRefManager().setOnlineOfflineState(false); + getHostileRefManager().setOnlineOfflineState(false); GetMotionMaster()->Clear(false); // remove different non-standard movement generators. } @@ -15075,7 +15075,7 @@ void Unit::RemoveCharmedBy(Unit *charmer) CastStop(); CombatStop(); //TODO: CombatStop(true) may cause crash (interrupt spells) - getHostilRefManager().deleteReferences(); + getHostileRefManager().deleteReferences(); DeleteThreatList(); RestoreFaction(); GetMotionMaster()->InitDefault(); @@ -16103,8 +16103,8 @@ void Unit::SendThreatListUpdate() WorldPacket data(SMSG_THREAT_UPDATE, 8 + count * 8); data.append(GetPackGUID()); data << uint32(count); - std::list& tlist = getThreatManager().getThreatList(); - for (std::list::const_iterator itr = tlist.begin(); itr != tlist.end(); ++itr) + std::list& tlist = getThreatManager().getThreatList(); + for (std::list::const_iterator itr = tlist.begin(); itr != tlist.end(); ++itr) { data.appendPackGUID((*itr)->getUnitGuid()); data << uint32((*itr)->getThreat()); @@ -16113,17 +16113,17 @@ void Unit::SendThreatListUpdate() } } -void Unit::SendChangeCurrentVictimOpcode(HostilReference* pHostilReference) +void Unit::SendChangeCurrentVictimOpcode(HostileReference* pHostileReference) { if (uint32 count = getThreatManager().getThreatList().size()) { sLog.outDebug( "WORLD: Send SMSG_HIGHEST_THREAT_UPDATE Message" ); WorldPacket data(SMSG_HIGHEST_THREAT_UPDATE, 8 + 8 + count * 8); data.append(GetPackGUID()); - data.appendPackGUID(pHostilReference->getUnitGuid()); + data.appendPackGUID(pHostileReference->getUnitGuid()); data << uint32(count); - std::list& tlist = getThreatManager().getThreatList(); - for (std::list::const_iterator itr = tlist.begin(); itr != tlist.end(); ++itr) + std::list& tlist = getThreatManager().getThreatList(); + for (std::list::const_iterator itr = tlist.begin(); itr != tlist.end(); ++itr) { data.appendPackGUID((*itr)->getUnitGuid()); data << uint32((*itr)->getThreat()); @@ -16140,12 +16140,12 @@ void Unit::SendClearThreatListOpcode() SendMessageToSet(&data, false); } -void Unit::SendRemoveFromThreatListOpcode(HostilReference* pHostilReference) +void Unit::SendRemoveFromThreatListOpcode(HostileReference* pHostileReference) { sLog.outDebug( "WORLD: Send SMSG_THREAT_REMOVE Message" ); WorldPacket data(SMSG_THREAT_REMOVE, 8 + 8); data.append(GetPackGUID()); - data.appendPackGUID(pHostilReference->getUnitGuid()); + data.appendPackGUID(pHostileReference->getUnitGuid()); SendMessageToSet(&data, false); } @@ -16208,7 +16208,7 @@ void Unit::StopAttackFaction(uint32 faction_id) ++itr; } - getHostilRefManager().deleteReferencesForFaction(faction_id); + getHostileRefManager().deleteReferencesForFaction(faction_id); for(ControlList::const_iterator itr = m_Controlled.begin(); itr != m_Controlled.end(); ++itr) (*itr)->StopAttackFaction(faction_id); diff --git a/src/game/Unit.h b/src/game/Unit.h index a35657890fa..0bdb3e573e0 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -28,7 +28,7 @@ #include "UpdateFields.h" #include "SharedDefines.h" #include "ThreatManager.h" -#include "HostilRefManager.h" +#include "HostileRefManager.h" #include "FollowerReference.h" #include "FollowerRefManager.h" #include "Utilities/EventProcessor.h" @@ -1442,9 +1442,9 @@ class Unit : public WorldObject void SendMonsterMoveWithSpeedToCurrentDestination(Player* player = NULL); void SendMovementFlagUpdate(); - void SendChangeCurrentVictimOpcode(HostilReference* pHostilReference); + void SendChangeCurrentVictimOpcode(HostileReference* pHostileReference); void SendClearThreatListOpcode(); - void SendRemoveFromThreatListOpcode(HostilReference* pHostilReference); + void SendRemoveFromThreatListOpcode(HostileReference* pHostileReference); void SendThreatListUpdate(); void BuildHeartBeatMsg(WorldPacket *data) const; @@ -1752,9 +1752,9 @@ class Unit : public WorldObject void TauntApply(Unit* pVictim); void TauntFadeOut(Unit *taunter); ThreatManager& getThreatManager() { return m_ThreatManager; } - void addHatedBy(HostilReference* pHostilReference) { m_HostilRefManager.insertFirst(pHostilReference); }; - void removeHatedBy(HostilReference* /*pHostilReference*/ ) { /* nothing to do yet */ } - HostilRefManager& getHostilRefManager() { return m_HostilRefManager; } + void addHatedBy(HostileReference* pHostileReference) { m_HostileRefManager.insertFirst(pHostileReference); }; + void removeHatedBy(HostileReference* /*pHostileReference*/ ) { /* nothing to do yet */ } + HostileRefManager& getHostileRefManager() { return m_HostileRefManager; } VisibleAuraMap const *GetVisibleAuras() { return &m_visibleAuras; } AuraApplication * GetVisibleAura(uint8 slot) @@ -2064,7 +2064,7 @@ class Unit : public WorldObject // Manage all Units threatening us // ThreatManager m_ThreatManager; // Manage all Units that are threatened by us - HostilRefManager m_HostilRefManager; + HostileRefManager m_HostileRefManager; FollowerRefManager m_FollowingRefManager; diff --git a/src/game/UnitAI.cpp b/src/game/UnitAI.cpp index 6a3f7b1157a..3eecf6a1c54 100644 --- a/src/game/UnitAI.cpp +++ b/src/game/UnitAI.cpp @@ -127,13 +127,13 @@ Unit* UnitAI::SelectTarget(SelectAggroTarget targetType, uint32 position, float void UnitAI::SelectTargetList(std::list &targetList, uint32 num, SelectAggroTarget targetType, float dist, bool playerOnly, int32 aura) { - const std::list &threatlist = me->getThreatManager().getThreatList(); + const std::list &threatlist = me->getThreatManager().getThreatList(); if (threatlist.empty()) return; DefaultTargetSelector targetSelector(me, dist,playerOnly, aura); - for (std::list::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr) + for (std::list::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr) if (targetSelector((*itr)->getTarget())) targetList.push_back((*itr)->getTarget()); @@ -167,8 +167,8 @@ void UnitAI::DoAddAuraToAllHostilePlayers(uint32 spellid) { if (me->isInCombat()) { - std::list& threatlist = me->getThreatManager().getThreatList(); - for (std::list::iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr) + std::list& threatlist = me->getThreatManager().getThreatList(); + for (std::list::iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr) { if (Unit *pTemp = Unit::GetUnit(*me,(*itr)->getUnitGuid())) if (pTemp->GetTypeId() == TYPEID_PLAYER) @@ -182,8 +182,8 @@ void UnitAI::DoCastToAllHostilePlayers(uint32 spellid, bool triggered) { if (me->isInCombat()) { - std::list& threatlist = me->getThreatManager().getThreatList(); - for (std::list::iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr) + std::list& threatlist = me->getThreatManager().getThreatList(); + for (std::list::iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr) { if (Unit *pTemp = Unit::GetUnit(*me,(*itr)->getUnitGuid())) if (pTemp->GetTypeId() == TYPEID_PLAYER) diff --git a/src/game/UnitAI.h b/src/game/UnitAI.h index 48d8aab385e..099b3fb88fa 100644 --- a/src/game/UnitAI.h +++ b/src/game/UnitAI.h @@ -72,15 +72,15 @@ class UnitAI // predicate shall extend std::unary_function template Unit* SelectTarget(SelectAggroTarget targetType, uint32 position, PREDICATE predicate) { - const std::list &threatlist = me->getThreatManager().getThreatList(); + const std::list &threatlist = me->getThreatManager().getThreatList(); std::list targetList; if (position >= threatlist.size()) return NULL; - for (std::list::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr) + for (std::list::const_iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr) { - HostilReference* ref = (*itr); + HostileReference* ref = (*itr); if (predicate(ref->getTarget())) targetList.push_back(ref->getTarget()); } diff --git a/src/game/UnitEvents.h b/src/game/UnitEvents.h index 69c66fe34b0..4e492ea144d 100644 --- a/src/game/UnitEvents.h +++ b/src/game/UnitEvents.h @@ -25,7 +25,7 @@ class ThreatContainer; class ThreatManager; -class HostilReference; +class HostileReference; //============================================================== //============================================================== @@ -87,7 +87,7 @@ class UnitBaseEvent class ThreatRefStatusChangeEvent : public UnitBaseEvent { private: - HostilReference* iHostilReference; + HostileReference* iHostileReference; union { float iFValue; @@ -96,13 +96,13 @@ class ThreatRefStatusChangeEvent : public UnitBaseEvent }; ThreatManager* iThreatManager; public: - ThreatRefStatusChangeEvent(uint32 pType) : UnitBaseEvent(pType) { iHostilReference = NULL; } + ThreatRefStatusChangeEvent(uint32 pType) : UnitBaseEvent(pType) { iHostileReference = NULL; } - ThreatRefStatusChangeEvent(uint32 pType, HostilReference* pHostilReference) : UnitBaseEvent(pType) { iHostilReference = pHostilReference; } + ThreatRefStatusChangeEvent(uint32 pType, HostileReference* pHostileReference) : UnitBaseEvent(pType) { iHostileReference = pHostileReference; } - ThreatRefStatusChangeEvent(uint32 pType, HostilReference* pHostilReference, float pValue) : UnitBaseEvent(pType) { iHostilReference = pHostilReference; iFValue = pValue; } + ThreatRefStatusChangeEvent(uint32 pType, HostileReference* pHostileReference, float pValue) : UnitBaseEvent(pType) { iHostileReference = pHostileReference; iFValue = pValue; } - ThreatRefStatusChangeEvent(uint32 pType, HostilReference* pHostilReference, bool pValue) : UnitBaseEvent(pType) { iHostilReference = pHostilReference; iBValue = pValue; } + ThreatRefStatusChangeEvent(uint32 pType, HostileReference* pHostileReference, bool pValue) : UnitBaseEvent(pType) { iHostileReference = pHostileReference; iBValue = pValue; } int32 getIValue() const { return iIValue; } @@ -112,7 +112,7 @@ class ThreatRefStatusChangeEvent : public UnitBaseEvent void setBValue(bool pValue) { iBValue = pValue; } - HostilReference* getReference() const { return iHostilReference; } + HostileReference* getReference() const { return iHostileReference; } void setThreatManager(ThreatManager* pThreatManager) { iThreatManager = pThreatManager; } @@ -127,7 +127,7 @@ class ThreatManagerEvent : public ThreatRefStatusChangeEvent ThreatContainer* iThreatContainer; public: ThreatManagerEvent(uint32 pType) : ThreatRefStatusChangeEvent(pType) {} - ThreatManagerEvent(uint32 pType, HostilReference* pHostilReference) : ThreatRefStatusChangeEvent(pType, pHostilReference) {} + ThreatManagerEvent(uint32 pType, HostileReference* pHostileReference) : ThreatRefStatusChangeEvent(pType, pHostileReference) {} void setThreatContainer(ThreatContainer* pThreatContainer) { iThreatContainer = pThreatContainer; } diff --git a/src/game/WaypointMovementGenerator.cpp b/src/game/WaypointMovementGenerator.cpp index 0288b5bb5e5..06b821178a0 100644 --- a/src/game/WaypointMovementGenerator.cpp +++ b/src/game/WaypointMovementGenerator.cpp @@ -246,7 +246,7 @@ uint32 FlightPathMovementGenerator::GetPathAtMapEnd() const void FlightPathMovementGenerator::Initialize(Player &player) { - player.getHostilRefManager().setOnlineOfflineState(false); + player.getHostileRefManager().setOnlineOfflineState(false); player.addUnitState(UNIT_STAT_IN_FLIGHT); player.SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_TAXI_FLIGHT); LoadPath(player); diff --git a/src/game/WorldSession.cpp b/src/game/WorldSession.cpp index cf487b1ca76..9a50a606b2b 100644 --- a/src/game/WorldSession.cpp +++ b/src/game/WorldSession.cpp @@ -311,14 +311,14 @@ void WorldSession::LogoutPlayer(bool Save) //FIXME: logout must be delayed in case lost connection with client in time of combat if (_player->GetDeathTimer()) { - _player->getHostilRefManager().deleteReferences(); + _player->getHostileRefManager().deleteReferences(); _player->BuildPlayerRepop(); _player->RepopAtGraveyard(); } else if (!_player->getAttackers().empty()) { _player->CombatStop(); - _player->getHostilRefManager().setOnlineOfflineState(false); + _player->getHostileRefManager().setOnlineOfflineState(false); _player->RemoveAllAurasOnDeath(); // build set of player who attack _player or who have pet attacking of _player diff --git a/src/scripts/eastern_kingdoms/blackwing_lair/boss_chromaggus.cpp b/src/scripts/eastern_kingdoms/blackwing_lair/boss_chromaggus.cpp index cee08a0bbec..20ebe58b7db 100644 --- a/src/scripts/eastern_kingdoms/blackwing_lair/boss_chromaggus.cpp +++ b/src/scripts/eastern_kingdoms/blackwing_lair/boss_chromaggus.cpp @@ -229,8 +229,8 @@ struct boss_chromaggusAI : public ScriptedAI //Affliction_Timer if (Affliction_Timer <= diff) { - std::list threatlist = m_creature->getThreatManager().getThreatList(); - for (std::list::iterator i = threatlist.begin(); i != threatlist.end(); ++i) + std::list threatlist = m_creature->getThreatManager().getThreatList(); + for (std::list::iterator i = threatlist.begin(); i != threatlist.end(); ++i) { Unit* pUnit; if ((*i) && (*i)->getSource()) diff --git a/src/scripts/eastern_kingdoms/karazhan/boss_midnight.cpp b/src/scripts/eastern_kingdoms/karazhan/boss_midnight.cpp index d684844c993..48a6ecf5412 100644 --- a/src/scripts/eastern_kingdoms/karazhan/boss_midnight.cpp +++ b/src/scripts/eastern_kingdoms/karazhan/boss_midnight.cpp @@ -244,9 +244,9 @@ struct boss_attumenAI : public ScriptedAI if (ChargeTimer <= diff) { Unit *pTarget; - std::list t_list = m_creature->getThreatManager().getThreatList(); + std::list t_list = m_creature->getThreatManager().getThreatList(); std::vector target_list; - for (std::list::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) + for (std::list::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) { pTarget = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()); if (pTarget && !pTarget->IsWithinDist(m_creature, ATTACK_DISTANCE, false)) diff --git a/src/scripts/eastern_kingdoms/karazhan/boss_prince_malchezaar.cpp b/src/scripts/eastern_kingdoms/karazhan/boss_prince_malchezaar.cpp index 3434ea54e1a..b9217b5a305 100644 --- a/src/scripts/eastern_kingdoms/karazhan/boss_prince_malchezaar.cpp +++ b/src/scripts/eastern_kingdoms/karazhan/boss_prince_malchezaar.cpp @@ -281,14 +281,14 @@ struct boss_malchezaarAI : public ScriptedAI if (!info) return; - std::list t_list = m_creature->getThreatManager().getThreatList(); + std::list t_list = m_creature->getThreatManager().getThreatList(); std::vector targets; if (!t_list.size()) return; //begin + 1, so we don't target the one with the highest threat - std::list::iterator itr = t_list.begin(); + std::list::iterator itr = t_list.begin(); std::advance(itr, 1); for (; itr != t_list.end(); ++itr) //store the threat list in a different container if (Unit *pTarget = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid())) diff --git a/src/scripts/eastern_kingdoms/karazhan/boss_shade_of_aran.cpp b/src/scripts/eastern_kingdoms/karazhan/boss_shade_of_aran.cpp index 39dc4481bbc..07128968456 100644 --- a/src/scripts/eastern_kingdoms/karazhan/boss_shade_of_aran.cpp +++ b/src/scripts/eastern_kingdoms/karazhan/boss_shade_of_aran.cpp @@ -175,13 +175,13 @@ struct boss_aranAI : public ScriptedAI void FlameWreathEffect() { std::vector targets; - std::list t_list = m_creature->getThreatManager().getThreatList(); + std::list t_list = m_creature->getThreatManager().getThreatList(); if (!t_list.size()) return; //store the threat list in a different container - for (std::list::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) + for (std::list::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) { Unit *pTarget = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()); //only on alive players diff --git a/src/scripts/eastern_kingdoms/magisters_terrace/boss_felblood_kaelthas.cpp b/src/scripts/eastern_kingdoms/magisters_terrace/boss_felblood_kaelthas.cpp index bf61a663521..acbd94e57d7 100644 --- a/src/scripts/eastern_kingdoms/magisters_terrace/boss_felblood_kaelthas.cpp +++ b/src/scripts/eastern_kingdoms/magisters_terrace/boss_felblood_kaelthas.cpp @@ -177,8 +177,8 @@ struct boss_felblood_kaelthasAI : public ScriptedAI if (!SummonedUnit) return; - std::list& m_threatlist = m_creature->getThreatManager().getThreatList(); - std::list::iterator i = m_threatlist.begin(); + std::list& m_threatlist = m_creature->getThreatManager().getThreatList(); + std::list::iterator i = m_threatlist.begin(); for (i = m_threatlist.begin(); i != m_threatlist.end(); ++i) { Unit* pUnit = Unit::GetUnit((*m_creature), (*i)->getUnitGuid()); @@ -196,7 +196,7 @@ struct boss_felblood_kaelthasAI : public ScriptedAI float y = KaelLocations[0][1]; m_creature->GetMap()->CreatureRelocation(m_creature, x, y, LOCATION_Z, 0.0f); //m_creature->SendMonsterMove(x, y, LOCATION_Z, 0, 0, 0); // causes some issues... - std::list::iterator i = m_creature->getThreatManager().getThreatList().begin(); + std::list::iterator i = m_creature->getThreatManager().getThreatList().begin(); for (i = m_creature->getThreatManager().getThreatList().begin(); i!= m_creature->getThreatManager().getThreatList().end(); ++i) { Unit* pUnit = Unit::GetUnit((*m_creature), (*i)->getUnitGuid()); @@ -208,7 +208,7 @@ struct boss_felblood_kaelthasAI : public ScriptedAI void CastGravityLapseKnockUp() { - std::list::iterator i = m_creature->getThreatManager().getThreatList().begin(); + std::list::iterator i = m_creature->getThreatManager().getThreatList().begin(); for (i = m_creature->getThreatManager().getThreatList().begin(); i!= m_creature->getThreatManager().getThreatList().end(); ++i) { Unit* pUnit = Unit::GetUnit((*m_creature), (*i)->getUnitGuid()); @@ -220,7 +220,7 @@ struct boss_felblood_kaelthasAI : public ScriptedAI void CastGravityLapseFly() // Use Fly Packet hack for now as players can't cast "fly" spells unless in map 530. Has to be done a while after they get knocked into the air... { - std::list::iterator i = m_creature->getThreatManager().getThreatList().begin(); + std::list::iterator i = m_creature->getThreatManager().getThreatList().begin(); for (i = m_creature->getThreatManager().getThreatList().begin(); i!= m_creature->getThreatManager().getThreatList().end(); ++i) { Unit* pUnit = Unit::GetUnit((*m_creature), (*i)->getUnitGuid()); @@ -240,7 +240,7 @@ struct boss_felblood_kaelthasAI : public ScriptedAI void RemoveGravityLapse() { - std::list::iterator i = m_creature->getThreatManager().getThreatList().begin(); + std::list::iterator i = m_creature->getThreatManager().getThreatList().begin(); for (i = m_creature->getThreatManager().getThreatList().begin(); i!= m_creature->getThreatManager().getThreatList().end(); ++i) { Unit* pUnit = Unit::GetUnit((*m_creature), (*i)->getUnitGuid()); diff --git a/src/scripts/eastern_kingdoms/magisters_terrace/boss_priestess_delrissa.cpp b/src/scripts/eastern_kingdoms/magisters_terrace/boss_priestess_delrissa.cpp index f14e1933988..c84879d5720 100644 --- a/src/scripts/eastern_kingdoms/magisters_terrace/boss_priestess_delrissa.cpp +++ b/src/scripts/eastern_kingdoms/magisters_terrace/boss_priestess_delrissa.cpp @@ -796,8 +796,8 @@ struct boss_yazzaiAI : public boss_priestess_lackey_commonAI if (Blink_Timer <= diff) { bool InMeleeRange = false; - std::list& t_list = m_creature->getThreatManager().getThreatList(); - for (std::list::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) + std::list& t_list = m_creature->getThreatManager().getThreatList(); + for (std::list::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) { if (Unit *pTarget = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid())) { @@ -876,8 +876,8 @@ struct boss_warlord_salarisAI : public boss_priestess_lackey_commonAI if (Intercept_Stun_Timer <= diff) { bool InMeleeRange = false; - std::list& t_list = m_creature->getThreatManager().getThreatList(); - for (std::list::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) + std::list& t_list = m_creature->getThreatManager().getThreatList(); + for (std::list::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) { if (Unit *pTarget = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid())) { diff --git a/src/scripts/eastern_kingdoms/scarlet_monastery/boss_headless_horseman.cpp b/src/scripts/eastern_kingdoms/scarlet_monastery/boss_headless_horseman.cpp index e79a8204e17..36863d5f3ca 100644 --- a/src/scripts/eastern_kingdoms/scarlet_monastery/boss_headless_horseman.cpp +++ b/src/scripts/eastern_kingdoms/scarlet_monastery/boss_headless_horseman.cpp @@ -559,7 +559,7 @@ struct boss_headless_horsemanAI : public ScriptedAI caster->GetMotionMaster()->Clear(false); caster->GetMotionMaster()->MoveFollow(m_creature,6,urand(0,5)); //DoResetThreat();//not sure if need - std::list::iterator itr; + std::list::iterator itr; for (itr = caster->getThreatManager().getThreatList().begin(); itr != caster->getThreatManager().getThreatList().end(); ++itr) { Unit* pUnit = Unit::GetUnit((*m_creature), (*itr)->getUnitGuid()); diff --git a/src/scripts/eastern_kingdoms/sunwell_plateau/boss_kalecgos.cpp b/src/scripts/eastern_kingdoms/sunwell_plateau/boss_kalecgos.cpp index 575bb0afaa1..6aaa00fd6ac 100644 --- a/src/scripts/eastern_kingdoms/sunwell_plateau/boss_kalecgos.cpp +++ b/src/scripts/eastern_kingdoms/sunwell_plateau/boss_kalecgos.cpp @@ -300,9 +300,9 @@ struct boss_kalecgosAI : public ScriptedAI if (SpectralBlastTimer <= diff) { - std::list &m_threatlist = me->getThreatManager().getThreatList(); + std::list &m_threatlist = me->getThreatManager().getThreatList(); std::list targetList; - for (std::list::iterator itr = m_threatlist.begin(); itr!= m_threatlist.end(); ++itr) + for (std::list::iterator itr = m_threatlist.begin(); itr!= m_threatlist.end(); ++itr) if((*itr)->getTarget() && (*itr)->getTarget()->GetTypeId() == TYPEID_PLAYER && (*itr)->getTarget()->GetGUID() != me->getVictim()->GetGUID() && !(*itr)->getTarget()->HasAura(AURA_SPECTRAL_EXHAUSTION) && (*itr)->getTarget()->GetPositionZ() > me->GetPositionZ()-5) targetList.push_back((*itr)->getTarget()); if(targetList.empty()) @@ -614,7 +614,7 @@ struct boss_sathrovarrAI : public ScriptedAI if (ResetThreat <= diff) { - for (std::list::iterator itr = me->getThreatManager().getThreatList().begin(); itr != me->getThreatManager().getThreatList().end(); ++itr) + for (std::list::iterator itr = me->getThreatManager().getThreatList().begin(); itr != me->getThreatManager().getThreatList().end(); ++itr) { if(Unit* pUnit = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid())) { diff --git a/src/scripts/eastern_kingdoms/sunwell_plateau/boss_kiljaeden.cpp b/src/scripts/eastern_kingdoms/sunwell_plateau/boss_kiljaeden.cpp index cdb79d5e2f6..87291ae807a 100644 --- a/src/scripts/eastern_kingdoms/sunwell_plateau/boss_kiljaeden.cpp +++ b/src/scripts/eastern_kingdoms/sunwell_plateau/boss_kiljaeden.cpp @@ -944,7 +944,7 @@ struct mob_hand_of_the_deceiverAI : public ScriptedAI Creature* Portal = DoSpawnCreature(CREATURE_FELFIRE_PORTAL, 0, 0,0, 0, TEMPSUMMON_TIMED_DESPAWN, 20000); if (Portal) { - std::list::iterator itr; + std::list::iterator itr; for (itr = m_creature->getThreatManager().getThreatList().begin(); itr != m_creature->getThreatManager().getThreatList().end(); ++itr) { Unit* pUnit = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()); diff --git a/src/scripts/eastern_kingdoms/zulgurub/boss_mandokir.cpp b/src/scripts/eastern_kingdoms/zulgurub/boss_mandokir.cpp index 0f8a3d515f3..7dcea97b86b 100644 --- a/src/scripts/eastern_kingdoms/zulgurub/boss_mandokir.cpp +++ b/src/scripts/eastern_kingdoms/zulgurub/boss_mandokir.cpp @@ -218,7 +218,7 @@ struct boss_mandokirAI : public ScriptedAI { TargetInRange = 0; - std::list::iterator i = m_creature->getThreatManager().getThreatList().begin(); + std::list::iterator i = m_creature->getThreatManager().getThreatList().begin(); for (; i != m_creature->getThreatManager().getThreatList().end(); ++i) { Unit* pUnit = Unit::GetUnit(*m_creature, (*i)->getUnitGuid()); diff --git a/src/scripts/kalimdor/boss_azuregos.cpp b/src/scripts/kalimdor/boss_azuregos.cpp index 94af33c83be..26801be6c8e 100644 --- a/src/scripts/kalimdor/boss_azuregos.cpp +++ b/src/scripts/kalimdor/boss_azuregos.cpp @@ -71,8 +71,8 @@ struct boss_azuregosAI : public ScriptedAI if (Teleport_Timer <= diff) { DoScriptText(SAY_TELEPORT, m_creature); - std::list& m_threatlist = m_creature->getThreatManager().getThreatList(); - std::list::iterator i = m_threatlist.begin(); + std::list& m_threatlist = m_creature->getThreatManager().getThreatList(); + std::list::iterator i = m_threatlist.begin(); for (i = m_threatlist.begin(); i!= m_threatlist.end(); ++i) { Unit* pUnit = Unit::GetUnit((*m_creature), (*i)->getUnitGuid()); diff --git a/src/scripts/kalimdor/caverns_of_time/hyjal/boss_archimonde.cpp b/src/scripts/kalimdor/caverns_of_time/hyjal/boss_archimonde.cpp index 30aeaceffc1..1377439c40b 100644 --- a/src/scripts/kalimdor/caverns_of_time/hyjal/boss_archimonde.cpp +++ b/src/scripts/kalimdor/caverns_of_time/hyjal/boss_archimonde.cpp @@ -302,12 +302,12 @@ struct boss_archimondeAI : public hyjal_trashAI if (victim && m_creature->IsWithinDistInMap(victim, m_creature->GetAttackDistance(victim))) return false; - std::list& m_threatlist = m_creature->getThreatManager().getThreatList(); + std::list& m_threatlist = m_creature->getThreatManager().getThreatList(); if (m_threatlist.empty()) return false; std::list targets; - std::list::iterator itr = m_threatlist.begin(); + std::list::iterator itr = m_threatlist.begin(); for (; itr != m_threatlist.end(); ++itr) { Unit* pUnit = Unit::GetUnit((*m_creature), (*itr)->getUnitGuid()); diff --git a/src/scripts/kalimdor/caverns_of_time/hyjal/boss_kazrogal.cpp b/src/scripts/kalimdor/caverns_of_time/hyjal/boss_kazrogal.cpp index a5c0f27fade..1885fadc3c1 100644 --- a/src/scripts/kalimdor/caverns_of_time/hyjal/boss_kazrogal.cpp +++ b/src/scripts/kalimdor/caverns_of_time/hyjal/boss_kazrogal.cpp @@ -152,8 +152,8 @@ struct boss_kazrogalAI : public hyjal_trashAI //cast dummy, useful for bos addons m_creature->CastCustomSpell(m_creature, SPELL_MARK, NULL, NULL, NULL, false, NULL, NULL, m_creature->GetGUID()); - std::list t_list = m_creature->getThreatManager().getThreatList(); - for (std::list::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) + std::list t_list = m_creature->getThreatManager().getThreatList(); + for (std::list::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) diff --git a/src/scripts/kalimdor/temple_of_ahnqiraj/boss_cthun.cpp b/src/scripts/kalimdor/temple_of_ahnqiraj/boss_cthun.cpp index 25fa866c833..bea64893b2c 100644 --- a/src/scripts/kalimdor/temple_of_ahnqiraj/boss_cthun.cpp +++ b/src/scripts/kalimdor/temple_of_ahnqiraj/boss_cthun.cpp @@ -654,7 +654,7 @@ struct cthunAI : public Scripted_NoMovementAI //Place all units in threat list on outside of stomach Stomach_Map.clear(); - std::list::iterator i = m_creature->getThreatManager().getThreatList().begin(); + std::list::iterator i = m_creature->getThreatManager().getThreatList().begin(); for (; i != m_creature->getThreatManager().getThreatList().end(); ++i) { //Outside stomach diff --git a/src/scripts/kalimdor/temple_of_ahnqiraj/mob_anubisath_sentinel.cpp b/src/scripts/kalimdor/temple_of_ahnqiraj/mob_anubisath_sentinel.cpp index 1c09e7e8eda..7cdb76a82e1 100644 --- a/src/scripts/kalimdor/temple_of_ahnqiraj/mob_anubisath_sentinel.cpp +++ b/src/scripts/kalimdor/temple_of_ahnqiraj/mob_anubisath_sentinel.cpp @@ -240,7 +240,7 @@ struct aqsentinelAI : public ScriptedAI Unit *GetHatedManaUser() const { - std::list::iterator i; + std::list::iterator i; for (i = m_creature->getThreatManager().getThreatList().begin(); i != m_creature->getThreatManager().getThreatList().end(); ++i) { Unit* pUnit = Unit::GetUnit((*m_creature), (*i)->getUnitGuid()); diff --git a/src/scripts/northrend/azjol_nerub/ahnkahet/boss_prince_taldaram.cpp b/src/scripts/northrend/azjol_nerub/ahnkahet/boss_prince_taldaram.cpp index 1d3e8ac9cd3..5c2cbb724c1 100644 --- a/src/scripts/northrend/azjol_nerub/ahnkahet/boss_prince_taldaram.cpp +++ b/src/scripts/northrend/azjol_nerub/ahnkahet/boss_prince_taldaram.cpp @@ -213,9 +213,9 @@ struct boss_taldaramAI : public ScriptedAI { //Count alive players Unit *pTarget = NULL; - std::list t_list = m_creature->getThreatManager().getThreatList(); + std::list t_list = m_creature->getThreatManager().getThreatList(); std::vector target_list; - for (std::list::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) + for (std::list::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) { pTarget = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()); // exclude pets & totems diff --git a/src/scripts/northrend/draktharon_keep/boss_tharon_ja.cpp b/src/scripts/northrend/draktharon_keep/boss_tharon_ja.cpp index 57e1bea1f70..31d4170ec3f 100644 --- a/src/scripts/northrend/draktharon_keep/boss_tharon_ja.cpp +++ b/src/scripts/northrend/draktharon_keep/boss_tharon_ja.cpp @@ -165,8 +165,8 @@ struct boss_tharon_jaAI : public ScriptedAI { DoScriptText(RAND(SAY_FLESH_1,SAY_FLESH_2),m_creature); m_creature->SetDisplayId(MODEL_FLESH); - std::list& threatlist = m_creature->getThreatManager().getThreatList(); - for (std::list::iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr) + std::list& threatlist = m_creature->getThreatManager().getThreatList(); + for (std::list::iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr) { Unit *pTemp = Unit::GetUnit((*m_creature),(*itr)->getUnitGuid()); if (pTemp && pTemp->GetTypeId() == TYPEID_PLAYER) @@ -221,8 +221,8 @@ struct boss_tharon_jaAI : public ScriptedAI uiCurseOfLifeTimer = 1000; uiRainOfFireTimer = urand(14000,18000); uiShadowVolleyTimer = urand(8000,10000); - std::list& threatlist = m_creature->getThreatManager().getThreatList(); - for (std::list::iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr) + std::list& threatlist = m_creature->getThreatManager().getThreatList(); + for (std::list::iterator itr = threatlist.begin(); itr != threatlist.end(); ++itr) { Unit *pTemp = Unit::GetUnit((*m_creature),(*itr)->getUnitGuid()); if (pTemp && pTemp->GetTypeId() == TYPEID_PLAYER) diff --git a/src/scripts/northrend/naxxramas/boss_kelthuzad.cpp b/src/scripts/northrend/naxxramas/boss_kelthuzad.cpp index 76ead936212..ce275fe952e 100644 --- a/src/scripts/northrend/naxxramas/boss_kelthuzad.cpp +++ b/src/scripts/northrend/naxxramas/boss_kelthuzad.cpp @@ -579,8 +579,8 @@ struct boss_kelthuzadAI : public BossAI case EVENT_DETONATE: { std::vector unitList; - std::list *threatList = &me->getThreatManager().getThreatList(); - for (std::list::const_iterator itr = threatList->begin(); itr != threatList->end(); ++itr) + std::list *threatList = &me->getThreatManager().getThreatList(); + for (std::list::const_iterator itr = threatList->begin(); itr != threatList->end(); ++itr) { if ((*itr)->getTarget()->GetTypeId() == TYPEID_PLAYER && (*itr)->getTarget()->getPowerType() == POWER_MANA diff --git a/src/scripts/northrend/naxxramas/boss_patchwerk.cpp b/src/scripts/northrend/naxxramas/boss_patchwerk.cpp index 68e27f5f722..438e0f91ec8 100644 --- a/src/scripts/northrend/naxxramas/boss_patchwerk.cpp +++ b/src/scripts/northrend/naxxramas/boss_patchwerk.cpp @@ -111,7 +111,7 @@ struct boss_patchwerkAI : public BossAI //amount of HP within melee distance uint32 MostHP = 0; Unit* pMostHPTarget = NULL; - std::list::iterator i = me->getThreatManager().getThreatList().begin(); + std::list::iterator i = me->getThreatManager().getThreatList().begin(); for (; i != me->getThreatManager().getThreatList().end(); ++i) { Unit *pTarget = (*i)->getTarget(); diff --git a/src/scripts/northrend/naxxramas/boss_sapphiron.cpp b/src/scripts/northrend/naxxramas/boss_sapphiron.cpp index b754cc124ef..9a613a7583e 100644 --- a/src/scripts/northrend/naxxramas/boss_sapphiron.cpp +++ b/src/scripts/northrend/naxxramas/boss_sapphiron.cpp @@ -291,7 +291,7 @@ struct boss_sapphironAI : public BossAI case EVENT_ICEBOLT: { std::vector targets; - std::list::iterator i = me->getThreatManager().getThreatList().begin(); + std::list::iterator i = me->getThreatManager().getThreatList().begin(); for (; i != me->getThreatManager().getThreatList().end(); ++i) if ((*i)->getTarget()->GetTypeId() == TYPEID_PLAYER && !(*i)->getTarget()->HasAura(SPELL_ICEBOLT)) targets.push_back((*i)->getTarget()); @@ -348,7 +348,7 @@ struct boss_sapphironAI : public BossAI { DoZoneInCombat(); // make sure everyone is in threatlist std::vector targets; - std::list::iterator i = me->getThreatManager().getThreatList().begin(); + std::list::iterator i = me->getThreatManager().getThreatList().begin(); for (; i != me->getThreatManager().getThreatList().end(); ++i) { Unit *pTarget = (*i)->getTarget(); diff --git a/src/scripts/northrend/nexus/nexus/boss_keristrasza.cpp b/src/scripts/northrend/nexus/nexus/boss_keristrasza.cpp index af51b19e553..0b1257e5b94 100644 --- a/src/scripts/northrend/nexus/nexus/boss_keristrasza.cpp +++ b/src/scripts/northrend/nexus/nexus/boss_keristrasza.cpp @@ -171,8 +171,8 @@ struct boss_keristraszaAI : public ScriptedAI if (CheckIntenseColdTimer < diff && !MoreThanTwoIntenseCold) { - std::list ThreatList = m_creature->getThreatManager().getThreatList(); - for (std::list::const_iterator itr = ThreatList.begin(); itr != ThreatList.end(); itr++) + std::list ThreatList = m_creature->getThreatManager().getThreatList(); + for (std::list::const_iterator itr = ThreatList.begin(); itr != ThreatList.end(); itr++) { Unit *pTarget = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()); if (!pTarget || pTarget->GetTypeId() != TYPEID_PLAYER) diff --git a/src/scripts/northrend/nexus/nexus/boss_ormorok.cpp b/src/scripts/northrend/nexus/nexus/boss_ormorok.cpp index 49bbecde614..95361f44732 100644 --- a/src/scripts/northrend/nexus/nexus/boss_ormorok.cpp +++ b/src/scripts/northrend/nexus/nexus/boss_ormorok.cpp @@ -184,7 +184,7 @@ struct boss_ormorokAI : public ScriptedAI case 3: Healer = CLASS_DRUID; break; case 4: Healer = CLASS_SHAMAN; break; } - std::list::iterator i = m_creature->getThreatManager().getThreatList().begin(); + std::list::iterator i = m_creature->getThreatManager().getThreatList().begin(); for (; i != m_creature->getThreatManager().getThreatList().end(); ++i) { Unit* pTemp = Unit::GetUnit((*m_creature),(*i)->getUnitGuid()); diff --git a/src/scripts/outland/auchindoun/shadow_labyrinth/boss_blackheart_the_inciter.cpp b/src/scripts/outland/auchindoun/shadow_labyrinth/boss_blackheart_the_inciter.cpp index 02e74e06445..9535be2bae1 100644 --- a/src/scripts/outland/auchindoun/shadow_labyrinth/boss_blackheart_the_inciter.cpp +++ b/src/scripts/outland/auchindoun/shadow_labyrinth/boss_blackheart_the_inciter.cpp @@ -121,8 +121,8 @@ struct boss_blackheart_the_inciterAI : public ScriptedAI { DoCast(m_creature, SPELL_INCITE_CHAOS); - std::list t_list = m_creature->getThreatManager().getThreatList(); - for (std::list::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) + std::list t_list = m_creature->getThreatManager().getThreatList(); + for (std::list::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) { Unit *pTarget = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()); if (pTarget && pTarget->GetTypeId() == TYPEID_PLAYER) diff --git a/src/scripts/outland/auchindoun/shadow_labyrinth/boss_murmur.cpp b/src/scripts/outland/auchindoun/shadow_labyrinth/boss_murmur.cpp index 60d8f5e63d2..a02148d4758 100644 --- a/src/scripts/outland/auchindoun/shadow_labyrinth/boss_murmur.cpp +++ b/src/scripts/outland/auchindoun/shadow_labyrinth/boss_murmur.cpp @@ -67,8 +67,8 @@ struct boss_murmurAI : public ScriptedAI void SonicBoomEffect() { - std::list t_list = m_creature->getThreatManager().getThreatList(); - for (std::list::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) + std::list t_list = m_creature->getThreatManager().getThreatList(); + for (std::list::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) { Unit *pTarget = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()); if (pTarget && pTarget->GetTypeId() == TYPEID_PLAYER) @@ -152,8 +152,8 @@ struct boss_murmurAI : public ScriptedAI // Thundering Storm if (ThunderingStorm_Timer <= diff) { - std::list& m_threatlist = m_creature->getThreatManager().getThreatList(); - for (std::list::iterator i = m_threatlist.begin(); i != m_threatlist.end(); ++i) + std::list& m_threatlist = m_creature->getThreatManager().getThreatList(); + for (std::list::iterator i = m_threatlist.begin(); i != m_threatlist.end(); ++i) if (Unit *pTarget = Unit::GetUnit((*m_creature),(*i)->getUnitGuid())) if (pTarget->isAlive() && !m_creature->IsWithinDist(pTarget, 35, false)) DoCast(pTarget, SPELL_THUNDERING_STORM, true); @@ -175,8 +175,8 @@ struct boss_murmurAI : public ScriptedAI return; if (!m_creature->IsWithinMeleeRange(m_creature->getVictim())) { - std::list& m_threatlist = m_creature->getThreatManager().getThreatList(); - for (std::list::iterator i = m_threatlist.begin(); i != m_threatlist.end(); ++i) + std::list& m_threatlist = m_creature->getThreatManager().getThreatList(); + for (std::list::iterator i = m_threatlist.begin(); i != m_threatlist.end(); ++i) if (Unit *pTarget = Unit::GetUnit((*m_creature),(*i)->getUnitGuid())) if (pTarget->isAlive() && m_creature->IsWithinMeleeRange(pTarget)) { diff --git a/src/scripts/outland/black_temple/boss_bloodboil.cpp b/src/scripts/outland/black_temple/boss_bloodboil.cpp index a0fa5ef8311..150b631e641 100644 --- a/src/scripts/outland/black_temple/boss_bloodboil.cpp +++ b/src/scripts/outland/black_temple/boss_bloodboil.cpp @@ -130,13 +130,13 @@ struct boss_gurtogg_bloodboilAI : public ScriptedAI void CastBloodboil() { // Get the Threat List - std::list m_threatlist = m_creature->getThreatManager().getThreatList(); + std::list m_threatlist = m_creature->getThreatManager().getThreatList(); if (!m_threatlist.size()) // He doesn't have anyone in his threatlist, useless to continue return; std::list targets; - std::list::iterator itr = m_threatlist.begin(); + std::list::iterator itr = m_threatlist.begin(); for (; itr!= m_threatlist.end(); ++itr) //store the threat list in a different container { Unit *pTarget = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()); diff --git a/src/scripts/outland/black_temple/boss_illidan.cpp b/src/scripts/outland/black_temple/boss_illidan.cpp index 6f1e4cc0e59..ed1b1d4df02 100644 --- a/src/scripts/outland/black_temple/boss_illidan.cpp +++ b/src/scripts/outland/black_temple/boss_illidan.cpp @@ -501,7 +501,7 @@ struct boss_illidan_stormrageAI : public ScriptedAI void DeleteFromThreatList(uint64 TargetGUID) { - for (std::list::iterator itr = m_creature->getThreatManager().getThreatList().begin(); itr != m_creature->getThreatManager().getThreatList().end(); ++itr) + for (std::list::iterator itr = m_creature->getThreatManager().getThreatList().begin(); itr != m_creature->getThreatManager().getThreatList().end(); ++itr) { if ((*itr)->getUnitGuid() == TargetGUID) { @@ -1070,9 +1070,9 @@ struct npc_akama_illidanAI : public ScriptedAI void KillAllElites() { - std::list& threatList = m_creature->getThreatManager().getThreatList(); + std::list& threatList = m_creature->getThreatManager().getThreatList(); std::vector eliteList; - for (std::list::iterator itr = threatList.begin(); itr != threatList.end(); ++itr) + for (std::list::iterator itr = threatList.begin(); itr != threatList.end(); ++itr) { Unit* pUnit = Unit::GetUnit((*m_creature), (*itr)->getUnitGuid()); if (pUnit && pUnit->GetEntry() == ILLIDARI_ELITE) diff --git a/src/scripts/outland/black_temple/boss_reliquary_of_souls.cpp b/src/scripts/outland/black_temple/boss_reliquary_of_souls.cpp index 43bf9471104..6504b9918aa 100644 --- a/src/scripts/outland/black_temple/boss_reliquary_of_souls.cpp +++ b/src/scripts/outland/black_temple/boss_reliquary_of_souls.cpp @@ -188,8 +188,8 @@ struct boss_reliquary_of_soulsAI : public ScriptedAI if (!pTarget) return; - std::list& m_threatlist = pTarget->getThreatManager().getThreatList(); - std::list::iterator itr = m_threatlist.begin(); + std::list& m_threatlist = pTarget->getThreatManager().getThreatList(); + std::list::iterator itr = m_threatlist.begin(); for (; itr != m_threatlist.end(); itr++) { Unit* pUnit = Unit::GetUnit((*m_creature), (*itr)->getUnitGuid()); @@ -386,11 +386,11 @@ struct boss_essence_of_sufferingAI : public ScriptedAI void CastFixate() { - std::list& m_threatlist = m_creature->getThreatManager().getThreatList(); + std::list& m_threatlist = m_creature->getThreatManager().getThreatList(); if (m_threatlist.empty()) return; // No point continuing if empty threatlist. std::list targets; - std::list::iterator itr = m_threatlist.begin(); + std::list::iterator itr = m_threatlist.begin(); for (; itr != m_threatlist.end(); ++itr) { Unit* pUnit = Unit::GetUnit((*m_creature), (*itr)->getUnitGuid()); diff --git a/src/scripts/outland/black_temple/boss_supremus.cpp b/src/scripts/outland/black_temple/boss_supremus.cpp index 8290fa6399b..24f75d5d1e0 100644 --- a/src/scripts/outland/black_temple/boss_supremus.cpp +++ b/src/scripts/outland/black_temple/boss_supremus.cpp @@ -149,8 +149,8 @@ struct boss_supremusAI : public ScriptedAI uint32 health = 0; Unit *pTarget = NULL; - std::list& m_threatlist = m_creature->getThreatManager().getThreatList(); - std::list::iterator i = m_threatlist.begin(); + std::list& m_threatlist = m_creature->getThreatManager().getThreatList(); + std::list::iterator i = m_threatlist.begin(); for (i = m_threatlist.begin(); i!= m_threatlist.end(); ++i) { Unit* pUnit = Unit::GetUnit((*m_creature), (*i)->getUnitGuid()); diff --git a/src/scripts/outland/black_temple/boss_teron_gorefiend.cpp b/src/scripts/outland/black_temple/boss_teron_gorefiend.cpp index f143f2e7323..c12bbd4249c 100644 --- a/src/scripts/outland/black_temple/boss_teron_gorefiend.cpp +++ b/src/scripts/outland/black_temple/boss_teron_gorefiend.cpp @@ -142,10 +142,10 @@ struct mob_shadowy_constructAI : public ScriptedAI void CheckPlayers() { - std::list& m_threatlist = m_creature->getThreatManager().getThreatList(); + std::list& m_threatlist = m_creature->getThreatManager().getThreatList(); if (m_threatlist.empty()) return; // No threat list. Don't continue. - std::list::iterator itr = m_threatlist.begin(); + std::list::iterator itr = m_threatlist.begin(); std::list targets; for (; itr != m_threatlist.end(); ++itr) { @@ -282,8 +282,8 @@ struct boss_teron_gorefiendAI : public ScriptedAI { if (!Blossom) return; - std::list& m_threatlist = m_creature->getThreatManager().getThreatList(); - std::list::iterator i = m_threatlist.begin(); + std::list& m_threatlist = m_creature->getThreatManager().getThreatList(); + std::list::iterator i = m_threatlist.begin(); for (i = m_threatlist.begin(); i != m_threatlist.end(); ++i) { Unit* pUnit = Unit::GetUnit((*m_creature), (*i)->getUnitGuid()); diff --git a/src/scripts/outland/coilfang_resevoir/serpent_shrine/boss_lady_vashj.cpp b/src/scripts/outland/coilfang_resevoir/serpent_shrine/boss_lady_vashj.cpp index 96d8c837877..d16f9a9e57f 100644 --- a/src/scripts/outland/coilfang_resevoir/serpent_shrine/boss_lady_vashj.cpp +++ b/src/scripts/outland/coilfang_resevoir/serpent_shrine/boss_lady_vashj.cpp @@ -439,8 +439,8 @@ struct boss_lady_vashjAI : public ScriptedAI { bool InMeleeRange = false; Unit *pTarget; - std::list t_list = m_creature->getThreatManager().getThreatList(); - for (std::list::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) + std::list t_list = m_creature->getThreatManager().getThreatList(); + for (std::list::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) { pTarget = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()); //if in melee range diff --git a/src/scripts/outland/coilfang_resevoir/serpent_shrine/boss_leotheras_the_blind.cpp b/src/scripts/outland/coilfang_resevoir/serpent_shrine/boss_leotheras_the_blind.cpp index b701d2d5c33..37b859a4097 100644 --- a/src/scripts/outland/coilfang_resevoir/serpent_shrine/boss_leotheras_the_blind.cpp +++ b/src/scripts/outland/coilfang_resevoir/serpent_shrine/boss_leotheras_the_blind.cpp @@ -478,9 +478,9 @@ struct boss_leotheras_the_blindAI : public ScriptedAI //Summon Inner Demon if (InnerDemons_Timer <= diff) { - std::list& ThreatList = m_creature->getThreatManager().getThreatList(); + std::list& ThreatList = m_creature->getThreatManager().getThreatList(); std::vector TargetList; - for (std::list::iterator itr = ThreatList.begin(); itr != ThreatList.end(); ++itr) + for (std::list::iterator itr = ThreatList.begin(); itr != ThreatList.end(); ++itr) { Unit *tempTarget = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()); if (tempTarget && tempTarget->GetTypeId() == TYPEID_PLAYER && tempTarget->GetGUID() != m_creature->getVictim()->GetGUID() && TargetList.size()<5) diff --git a/src/scripts/outland/gruuls_lair/boss_high_king_maulgar.cpp b/src/scripts/outland/gruuls_lair/boss_high_king_maulgar.cpp index c55bf2b8b70..4e586b2057f 100644 --- a/src/scripts/outland/gruuls_lair/boss_high_king_maulgar.cpp +++ b/src/scripts/outland/gruuls_lair/boss_high_king_maulgar.cpp @@ -706,9 +706,9 @@ struct boss_krosh_firehandAI : public ScriptedAI if (BlastWave_Timer <= diff) { Unit *pTarget; - std::list t_list = m_creature->getThreatManager().getThreatList(); + std::list t_list = m_creature->getThreatManager().getThreatList(); std::vector target_list; - for (std::list::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) + for (std::list::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) { pTarget = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()); //15 yard radius minimum diff --git a/src/scripts/outland/netherstorm.cpp b/src/scripts/outland/netherstorm.cpp index 16c4abea69e..25dba020be4 100644 --- a/src/scripts/outland/netherstorm.cpp +++ b/src/scripts/outland/netherstorm.cpp @@ -743,10 +743,10 @@ struct mob_phase_hunterAI : public ScriptedAI // some code to cast spell Mana Burn on random target which has mana if (ManaBurnTimer <= diff) { - std::list AggroList = m_creature->getThreatManager().getThreatList(); + std::list AggroList = m_creature->getThreatManager().getThreatList(); std::list UnitsWithMana; - for(std::list::const_iterator itr = AggroList.begin(); itr != AggroList.end(); ++itr) + for(std::list::const_iterator itr = AggroList.begin(); itr != AggroList.end(); ++itr) { if(Unit *pUnit = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid())) { diff --git a/src/scripts/outland/shadowmoon_valley.cpp b/src/scripts/outland/shadowmoon_valley.cpp index 341f5abde60..cd9a253d4cb 100644 --- a/src/scripts/outland/shadowmoon_valley.cpp +++ b/src/scripts/outland/shadowmoon_valley.cpp @@ -230,7 +230,7 @@ struct mob_enslaved_netherwing_drakeAI : public ScriptedAI AttackStart(Dragonmaw); } - HostilReference* ref = m_creature->getThreatManager().getOnlineContainer().getReferenceByTarget(caster); + HostileReference* ref = m_creature->getThreatManager().getOnlineContainer().getReferenceByTarget(caster); if (ref) ref->removeReference(); } diff --git a/src/scripts/outland/tempest_keep/the_eye/boss_kaelthas.cpp b/src/scripts/outland/tempest_keep/the_eye/boss_kaelthas.cpp index 2962ede14df..0fc0c57d2e2 100644 --- a/src/scripts/outland/tempest_keep/the_eye/boss_kaelthas.cpp +++ b/src/scripts/outland/tempest_keep/the_eye/boss_kaelthas.cpp @@ -851,7 +851,7 @@ struct boss_kaelthasAI : public ScriptedAI //GravityLapse_Timer if (GravityLapse_Timer <= diff) { - std::list::iterator i = m_creature->getThreatManager().getThreatList().begin(); + std::list::iterator i = m_creature->getThreatManager().getThreatList().begin(); switch (GravityLapse_Phase) { case 0: @@ -1196,8 +1196,8 @@ struct boss_grand_astromancer_capernianAI : public advisorbase_ai { bool InMeleeRange = false; Unit *pTarget = NULL; - std::list& m_threatlist = m_creature->getThreatManager().getThreatList(); - for (std::list::iterator i = m_threatlist.begin(); i!= m_threatlist.end(); ++i) + std::list& m_threatlist = m_creature->getThreatManager().getThreatList(); + for (std::list::iterator i = m_threatlist.begin(); i!= m_threatlist.end(); ++i) { Unit* pUnit = Unit::GetUnit((*m_creature), (*i)->getUnitGuid()); //if in melee range diff --git a/src/scripts/outland/tempest_keep/the_eye/boss_void_reaver.cpp b/src/scripts/outland/tempest_keep/the_eye/boss_void_reaver.cpp index ca0f42ed5af..84dd5af73d0 100644 --- a/src/scripts/outland/tempest_keep/the_eye/boss_void_reaver.cpp +++ b/src/scripts/outland/tempest_keep/the_eye/boss_void_reaver.cpp @@ -109,9 +109,9 @@ struct boss_void_reaverAI : public ScriptedAI if (ArcaneOrb_Timer <= diff) { Unit *pTarget = NULL; - std::list t_list = m_creature->getThreatManager().getThreatList(); + std::list t_list = m_creature->getThreatManager().getThreatList(); std::vector target_list; - for (std::list::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) + for (std::list::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) { pTarget = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()); if (!pTarget) diff --git a/win/VC90/game.vcproj b/win/VC90/game.vcproj index 3cd3d712c51..172b1cbfd8d 100644 --- a/win/VC90/game.vcproj +++ b/win/VC90/game.vcproj @@ -1355,11 +1355,11 @@ >