diff --git a/src/bindings/universal/ScriptMgr.cpp b/src/bindings/universal/ScriptMgr.cpp index b27111639..52e3a2e5e 100644 --- a/src/bindings/universal/ScriptMgr.cpp +++ b/src/bindings/universal/ScriptMgr.cpp @@ -298,7 +298,7 @@ bool EffectDummyItem(Unit *caster, uint32 spellId, uint32 effIndex, Item *itemTa void ScriptedAI::UpdateAI(const uint32) { //Check if we have a current target - if( m_creature->isAlive() && m_creature->SelectHostilTarget() && m_creature->getVictim()) + if( m_creature->isAlive() && m_creature->SelectHostileTarget() && m_creature->getVictim()) { //If we are within range melee the target if( m_creature->IsWithinDistInMap(m_creature->getVictim(), ATTACK_DISTANCE)) diff --git a/src/game/AggressorAI.cpp b/src/game/AggressorAI.cpp index 5f61eb35c..63c4f03c0 100644 --- a/src/game/AggressorAI.cpp +++ b/src/game/AggressorAI.cpp @@ -122,7 +122,7 @@ void AggressorAI::UpdateAI(const uint32 /*diff*/) { // update i_victimGuid if m_creature->getVictim() !=0 and changed - if(!m_creature->SelectHostilTarget() || !m_creature->getVictim()) + if(!m_creature->SelectHostileTarget() || !m_creature->getVictim()) return; i_victimGuid = m_creature->getVictim()->GetGUID(); diff --git a/src/game/BattleGround.cpp b/src/game/BattleGround.cpp index e72d77cf7..13d922800 100644 --- a/src/game/BattleGround.cpp +++ b/src/game/BattleGround.cpp @@ -749,7 +749,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/CreatureEventAI.cpp b/src/game/CreatureEventAI.cpp index 74707b227..e7fa84a08 100644 --- a/src/game/CreatureEventAI.cpp +++ b/src/game/CreatureEventAI.cpp @@ -524,8 +524,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; @@ -635,8 +635,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) ((Player*)Temp)->CastedCreatureOrGO(action.cast_event_all.creatureId, m_creature->GetGUID(), action.cast_event_all.spellId); @@ -1034,7 +1034,7 @@ void CreatureEventAI::SpellHit(Unit* pUnit, const SpellEntry* pSpell) void CreatureEventAI::UpdateAI(const uint32 diff) { //Check if we are in combat (also updates calls threat update code) - bool Combat = m_creature->SelectHostilTarget() && m_creature->getVictim(); + bool Combat = m_creature->SelectHostileTarget() && m_creature->getVictim(); //Must return if creature isn't alive. Normally select hostil target and get victim prevent this if (!m_creature->isAlive()) @@ -1115,9 +1115,9 @@ bool CreatureEventAI::IsVisible(Unit *pl) const 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/GuardAI.cpp b/src/game/GuardAI.cpp index e87f5812b..236bfd195 100644 --- a/src/game/GuardAI.cpp +++ b/src/game/GuardAI.cpp @@ -108,7 +108,7 @@ void GuardAI::EnterEvadeMode() void GuardAI::UpdateAI(const uint32 /*diff*/) { // update i_victimGuid if i_creature.getVictim() !=0 and changed - if (!m_creature->SelectHostilTarget() || !m_creature->getVictim()) + if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) return; i_victimGuid = m_creature->getVictim()->GetGUID(); diff --git a/src/game/HostilRefManager.cpp b/src/game/HostilRefManager.cpp index 5b1f83787..0fa7e379a 100644 --- a/src/game/HostilRefManager.cpp +++ b/src/game/HostilRefManager.cpp @@ -22,7 +22,7 @@ #include "DBCStructure.h" #include "SpellMgr.h" -HostilRefManager::~HostilRefManager() +HostileRefManager::~HostileRefManager() { deleteReferences(); } @@ -32,9 +32,9 @@ HostilRefManager::~HostilRefManager() // The pVictim is hated than by them as well // use for buffs and healing threat functionality -void HostilRefManager::threatAssist(Unit *pVictim, float pThreat, SpellEntry const *pThreatSpell, bool pSingleTarget) +void HostileRefManager::threatAssist(Unit *pVictim, float pThreat, SpellEntry const *pThreatSpell, bool pSingleTarget) { - HostilReference* ref; + HostileReference* ref; uint32 size = pSingleTarget ? 1 : getSize(); // if pSingleTarget do not devide threat ref = getFirst(); @@ -51,9 +51,9 @@ void HostilRefManager::threatAssist(Unit *pVictim, float pThreat, SpellEntry con //================================================= -void HostilRefManager::addThreatPercent(int32 pValue) +void HostileRefManager::addThreatPercent(int32 pValue) { - HostilReference* ref; + HostileReference* ref; ref = getFirst(); while(ref != NULL) @@ -66,9 +66,9 @@ void HostilRefManager::addThreatPercent(int32 pValue) //================================================= // The online / offline status is given to the method. The calculation has to be done before -void HostilRefManager::setOnlineOfflineState(bool pIsOnline) +void HostileRefManager::setOnlineOfflineState(bool pIsOnline) { - HostilReference* ref; + HostileReference* ref; ref = getFirst(); while(ref != NULL) @@ -81,9 +81,9 @@ void HostilRefManager::setOnlineOfflineState(bool pIsOnline) //================================================= // The online / offline status is calculated and set -void HostilRefManager::updateThreatTables() +void HostileRefManager::updateThreatTables() { - HostilReference* ref = getFirst(); + HostileReference* ref = getFirst(); while(ref) { ref->updateOnlineStatus(); @@ -95,12 +95,12 @@ void HostilRefManager::updateThreatTables() // The references are not needed anymore // tell the source to remove them from the list and free the mem -void HostilRefManager::deleteReferences() +void HostileRefManager::deleteReferences() { - HostilReference* ref = getFirst(); + HostileReference* ref = getFirst(); while(ref) { - HostilReference* nextRef = ref->next(); + HostileReference* nextRef = ref->next(); ref->removeReference(); delete ref; ref = nextRef; @@ -110,12 +110,12 @@ void HostilRefManager::deleteReferences() //================================================= // delete one reference, defined by Unit -void HostilRefManager::deleteReference(Unit *pCreature) +void HostileRefManager::deleteReference(Unit *pCreature) { - HostilReference* ref = getFirst(); + HostileReference* ref = getFirst(); while(ref) { - HostilReference* nextRef = ref->next(); + HostileReference* nextRef = ref->next(); if(ref->getSource()->getOwner() == pCreature) { ref->removeReference(); @@ -129,12 +129,12 @@ void HostilRefManager::deleteReference(Unit *pCreature) //================================================= // set state for one reference, defined by Unit -void HostilRefManager::setOnlineOfflineState(Unit *pCreature,bool pIsOnline) +void HostileRefManager::setOnlineOfflineState(Unit *pCreature,bool pIsOnline) { - HostilReference* ref = getFirst(); + HostileReference* ref = getFirst(); while(ref) { - HostilReference* nextRef = ref->next(); + HostileReference* nextRef = ref->next(); if(ref->getSource()->getOwner() == pCreature) { ref->setOnlineOfflineState(pIsOnline); diff --git a/src/game/HostilRefManager.h b/src/game/HostilRefManager.h index 64f6988cc..93945e669 100644 --- a/src/game/HostilRefManager.h +++ b/src/game/HostilRefManager.h @@ -24,18 +24,18 @@ class Unit; class ThreatManager; -class HostilReference; +class HostileReference; struct SpellEntry; //================================================= -class HostilRefManager : public RefManager +class HostileRefManager : public RefManager { private: Unit *iOwner; public: - explicit HostilRefManager(Unit *pOwner) { iOwner = pOwner; } - ~HostilRefManager(); + explicit HostileRefManager(Unit *pOwner) { iOwner = pOwner; } + ~HostileRefManager(); Unit* getOwner() { return iOwner; } @@ -50,7 +50,7 @@ class HostilRefManager : public RefManager // tell the source to remove them from the list and free the mem void deleteReferences(); - HostilReference* getFirst() { return ((HostilReference* ) RefManager::getFirst()); } + HostileReference* getFirst() { return ((HostileReference* ) RefManager::getFirst()); } void updateThreatTables(); diff --git a/src/game/Level2.cpp b/src/game/Level2.cpp index fcff303e7..cdd9508f7 100644 --- a/src/game/Level2.cpp +++ b/src/game/Level2.cpp @@ -3904,7 +3904,7 @@ bool ChatHandler::HandleCombatStopCommand(const char* args) return false; target->CombatStop(); - target->getHostilRefManager().deleteReferences(); + target->getHostileRefManager().deleteReferences(); return true; } diff --git a/src/game/PetAI.cpp b/src/game/PetAI.cpp index 9dc77d412..e18f4e7fb 100644 --- a/src/game/PetAI.cpp +++ b/src/game/PetAI.cpp @@ -106,7 +106,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 05130dd3d..06cae2ef2 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -2185,7 +2185,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) @@ -2199,7 +2199,7 @@ void Player::SetGameMaster(bool on) if (Pet* pet = GetPet()) { pet->setFaction(35); - pet->getHostilRefManager().setOnlineOfflineState(false); + pet->getHostileRefManager().setOnlineOfflineState(false); } for (int8 i = 0; i < MAX_TOTEM; ++i) @@ -2210,7 +2210,7 @@ void Player::SetGameMaster(bool on) 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 @@ -2228,7 +2228,7 @@ void Player::SetGameMaster(bool on) if (Pet* pet = GetPet()) { pet->setFaction(getFaction()); - pet->getHostilRefManager().setOnlineOfflineState(true); + pet->getHostileRefManager().setOnlineOfflineState(true); } for (int8 i = 0; i < MAX_TOTEM; ++i) @@ -2243,7 +2243,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); } UpdateVisibilityForPlayer(); diff --git a/src/game/ReactorAI.cpp b/src/game/ReactorAI.cpp index a27c39f11..545e61ff3 100644 --- a/src/game/ReactorAI.cpp +++ b/src/game/ReactorAI.cpp @@ -68,7 +68,7 @@ void ReactorAI::UpdateAI(const uint32 /*time_diff*/) { // update i_victimGuid if i_creature.getVictim() !=0 and changed - if(!m_creature->SelectHostilTarget() || !m_creature->getVictim()) + if(!m_creature->SelectHostileTarget() || !m_creature->getVictim()) return; i_victimGuid = m_creature->getVictim()->GetGUID(); diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index f0cd9f1ad..0d2cdb287 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -970,7 +970,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target) caster->ProcDamageAndSpell(unitTarget, procAttacker, procVictim, procEx, addhealth, m_attackType, m_spellInfo); 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) @@ -1116,7 +1116,7 @@ void Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask) if (unit->isInCombat() && !(m_spellInfo->AttributesEx & SPELL_ATTR_EX_NO_INITIAL_AGGRO)) { realCaster->SetInCombatState(unit->GetCombatTimer() > 0); - unit->getHostilRefManager().threatAssist(realCaster, 0.0f); + unit->getHostileRefManager().threatAssist(realCaster, 0.0f); } } } diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 675cdc6b6..ec29a8e0e 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -4038,7 +4038,7 @@ void Aura::HandleAuraModTotalThreat(bool apply, bool Real) float threatMod = apply ? float(m_modifier.m_amount) : float(-m_modifier.m_amount); - m_target->getHostilRefManager().threatAssist(caster, threatMod); + m_target->getHostileRefManager().threatAssist(caster, threatMod); } void Aura::HandleModTaunt(bool apply, bool Real) @@ -6408,7 +6408,7 @@ void Aura::PeriodicTick() uint32 heal = pCaster->SpellHealingBonus(pCaster, GetSpellProto(), uint32(new_damage * multiplier), DOT, GetStackAmount()); int32 gain = pCaster->DealHeal(pCaster, heal, GetSpellProto()); - pCaster->getHostilRefManager().threatAssist(pCaster, gain * 0.5f, GetSpellProto()); + pCaster->getHostileRefManager().threatAssist(pCaster, gain * 0.5f, GetSpellProto()); break; } case SPELL_AURA_PERIODIC_HEAL: @@ -6460,7 +6460,7 @@ void Aura::PeriodicTick() if( BattleGround *bg = ((Player*)pCaster)->GetBattleGround() ) bg->UpdatePlayerScore(((Player*)pCaster), SCORE_HEALING_DONE, gain); - m_target->getHostilRefManager().threatAssist(pCaster, float(gain) * 0.5f, GetSpellProto()); + m_target->getHostileRefManager().threatAssist(pCaster, float(gain) * 0.5f, GetSpellProto()); SpellEntry const* spellProto = GetSpellProto(); @@ -6590,7 +6590,7 @@ void Aura::PeriodicTick() int32 gain = m_target->ModifyPower(power,pdamage); if(Unit* pCaster = GetCaster()) - m_target->getHostilRefManager().threatAssist(pCaster, float(gain) * 0.5f, GetSpellProto()); + m_target->getHostileRefManager().threatAssist(pCaster, float(gain) * 0.5f, GetSpellProto()); break; } case SPELL_AURA_OBS_MOD_MANA: @@ -6612,7 +6612,7 @@ void Aura::PeriodicTick() int32 gain = m_target->ModifyPower(POWER_MANA, pdamage); if(Unit* pCaster = GetCaster()) - m_target->getHostilRefManager().threatAssist(pCaster, float(gain) * 0.5f, GetSpellProto()); + m_target->getHostileRefManager().threatAssist(pCaster, float(gain) * 0.5f, GetSpellProto()); break; } case SPELL_AURA_POWER_BURN_MANA: @@ -6665,7 +6665,7 @@ void Aura::PeriodicTick() { int32 gain = m_target->ModifyHealth(m_modifier.m_amount); if (Unit *caster = GetCaster()) - m_target->getHostilRefManager().threatAssist(caster, float(gain) * 0.5f, GetSpellProto()); + m_target->getHostileRefManager().threatAssist(caster, float(gain) * 0.5f, GetSpellProto()); break; } case SPELL_AURA_MOD_POWER_REGEN: diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index aaff04b99..96b1e6252 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -2584,7 +2584,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); } } @@ -5513,7 +5513,7 @@ void Spell::EffectSanctuary(uint32 /*i*/) //unitTarget->CombatStop(); 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_spellInfo->SpellFamilyName == SPELLFAMILY_ROGUE && (m_spellInfo->SpellFamilyFlags & SPELLFAMILYFLAG_ROGUE_VANISH)) { diff --git a/src/game/ThreatManager.cpp b/src/game/ThreatManager.cpp index a058a8fc7..a8802d4d9 100644 --- a/src/game/ThreatManager.cpp +++ b/src/game/ThreatManager.cpp @@ -41,10 +41,10 @@ float ThreatCalcHelper::calcThreat(Unit* pHatedUnit, Unit* pHatingUnit, float pT } //============================================================ -//================= HostilReference ========================== +//================= HostileReference ========================== //============================================================ -HostilReference::HostilReference(Unit* pUnit, ThreatManager *pThreatManager, float pThreat) +HostileReference::HostileReference(Unit* pUnit, ThreatManager *pThreatManager, float pThreat) { iThreat = pThreat; iTempThreatModifyer = 0.0f; @@ -56,14 +56,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); } @@ -71,7 +71,7 @@ void HostilReference::targetObjectDestroyLink() //============================================================ // Tell our refFrom (source) object, that the link is cut (Target destroyed) -void HostilReference::sourceObjectDestroyLink() +void HostileReference::sourceObjectDestroyLink() { setOnlineOfflineState(false); } @@ -79,7 +79,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); @@ -87,7 +87,7 @@ void HostilReference::fireStatusChanged(ThreatRefStatusChangeEvent& pThreatRefSt //============================================================ -void HostilReference::addThreat(float pMod) +void HostileReference::addThreat(float pMod) { iThreat += pMod; // the threat is changed. Source and target unit have to be availabe @@ -111,7 +111,7 @@ void HostilReference::addThreat(float pMod) //============================================================ // check, if source can reach target and set the status -void HostilReference::updateOnlineStatus() +void HostileReference::updateOnlineStatus() { bool online = false; bool accessible = false; @@ -148,7 +148,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) { @@ -163,7 +163,7 @@ void HostilReference::setOnlineOfflineState(bool pIsOnline) //============================================================ -void HostilReference::setAccessibleState(bool pIsAccessible) +void HostileReference::setAccessibleState(bool pIsAccessible) { if(iAccessible != pIsAccessible) { @@ -178,7 +178,7 @@ void HostilReference::setAccessibleState(bool pIsAccessible) // prepare the reference for deleting // this is called be the target -void HostilReference::removeReference() +void HostileReference::removeReference() { invalidate(); @@ -188,7 +188,7 @@ void HostilReference::removeReference() //============================================================ -Unit* HostilReference::getSourceUnit() +Unit* HostileReference::getSourceUnit() { return (getSource()->getOwner()); } @@ -199,7 +199,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); @@ -208,12 +208,12 @@ 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 pThreat) +HostileReference* ThreatContainer::addThreat(Unit* pVictim, float pThreat) { - HostilReference* ref = getReferenceByTarget(pVictim); + HostileReference* ref = getReferenceByTarget(pVictim); if(ref) ref->addThreat(pThreat); return ref; @@ -240,13 +240,13 @@ HostilReference* ThreatContainer::addThreat(Unit* pVictim, float pThreat) void ThreatContainer::modifyThreatPercent(Unit *pVictim, int32 pPercent) { - if(HostilReference* ref = getReferenceByTarget(pVictim)) + if(HostileReference* ref = getReferenceByTarget(pVictim)) ref->addThreatPercent(pPercent); } //============================================================ -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); @@ -380,7 +380,7 @@ void ThreatManager::addThreat(Unit* pVictim, float pThreat, SpellSchoolMask scho float threat = ThreatCalcHelper::calcThreat(pVictim, iOwner, pThreat, schoolMask, pThreatSpell); - HostilReference* ref = iThreatContainer.addThreat(pVictim, threat); + HostileReference* ref = iThreatContainer.addThreat(pVictim, threat); // Ref is not in the online refs, search the offline refs next if(!ref) ref = iThreatOfflineContainer.addThreat(pVictim, threat); @@ -388,11 +388,11 @@ void ThreatManager::addThreat(Unit* pVictim, float pThreat, SpellSchoolMask scho if(!ref) // there was no ref => create a new one { // threat has to be 0 here - HostilReference* hostilReference = new HostilReference(pVictim, this, 0); - iThreatContainer.addReference(hostilReference); - hostilReference->addThreat(threat); // now we add the real threat + HostileReference* hostileReference = new HostileReference(pVictim, this, 0); + iThreatContainer.addReference(hostileReference); + hostileReference->addThreat(threat); // now we add the real threat if(pVictim->GetTypeId() == TYPEID_PLAYER && ((Player*)pVictim)->isGameMaster()) - hostilReference->setOnlineOfflineState(false); // GM is always offline + hostileReference->setOnlineOfflineState(false); // GM is always offline } } @@ -405,10 +405,10 @@ void ThreatManager::modifyThreatPercent(Unit *pVictim, int32 pPercent) //============================================================ -Unit* ThreatManager::getHostilTarget() +Unit* ThreatManager::getHostileTarget() { iThreatContainer.update(); - HostilReference* nextVictim = iThreatContainer.selectNextVictim((Creature*) getOwner(), getCurrentVictim()); + HostileReference* nextVictim = iThreatContainer.selectNextVictim((Creature*) getOwner(), getCurrentVictim()); setCurrentVictim(nextVictim); return getCurrentVictim() != NULL ? getCurrentVictim()->getTarget() : NULL; } @@ -418,7 +418,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) @@ -430,7 +430,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->getTempThreatModifyer() == 0.0f) @@ -443,16 +443,16 @@ 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) { - iCurrentVictim = pHostilReference; + iCurrentVictim = pHostileReference; } //============================================================ @@ -463,44 +463,44 @@ void ThreatManager::processThreatEvent(ThreatRefStatusChangeEvent* threatRefStat { threatRefStatusChangeEvent->setThreatManager(this); // now we can set the threat manager - HostilReference* hostilReference = threatRefStatusChangeEvent->getReference(); + HostileReference* hostileReference = threatRefStatusChangeEvent->getReference(); switch(threatRefStatusChangeEvent->getType()) { case UEV_THREAT_REF_THREAT_CHANGE: - if((getCurrentVictim() == hostilReference && threatRefStatusChangeEvent->getFValue()<0.0f) || - (getCurrentVictim() != hostilReference && threatRefStatusChangeEvent->getFValue()>0.0f)) + if((getCurrentVictim() == hostileReference && threatRefStatusChangeEvent->getFValue()<0.0f) || + (getCurrentVictim() != hostileReference && threatRefStatusChangeEvent->getFValue()>0.0f)) setDirty(true); // the order in the threat list might have changed break; case UEV_THREAT_REF_ONLINE_STATUS: - if(!hostilReference->isOnline()) + if(!hostileReference->isOnline()) { - if (hostilReference == getCurrentVictim()) + if (hostileReference == getCurrentVictim()) { setCurrentVictim(NULL); setDirty(true); } - iThreatContainer.remove(hostilReference); - iThreatOfflineContainer.addReference(hostilReference); + iThreatContainer.remove(hostileReference); + iThreatOfflineContainer.addReference(hostileReference); } else { - if(getCurrentVictim() && hostilReference->getThreat() > (1.1f * getCurrentVictim()->getThreat())) + if(getCurrentVictim() && hostileReference->getThreat() > (1.1f * getCurrentVictim()->getThreat())) setDirty(true); - iThreatContainer.addReference(hostilReference); - iThreatOfflineContainer.remove(hostilReference); + iThreatContainer.addReference(hostileReference); + iThreatOfflineContainer.remove(hostileReference); } break; case UEV_THREAT_REF_REMOVE_FROM_LIST: - if (hostilReference == getCurrentVictim()) + if (hostileReference == getCurrentVictim()) { setCurrentVictim(NULL); setDirty(true); } - if(hostilReference->isOnline()) - iThreatContainer.remove(hostilReference); + if(hostileReference->isOnline()) + iThreatContainer.remove(hostileReference); else - iThreatOfflineContainer.remove(hostilReference); + iThreatOfflineContainer.remove(hostileReference); break; } } diff --git a/src/game/ThreatManager.h b/src/game/ThreatManager.h index d569480f9..55460304c 100644 --- a/src/game/ThreatManager.h +++ b/src/game/ThreatManager.h @@ -43,10 +43,10 @@ class ThreatCalcHelper }; //============================================================== -class MANGOS_DLL_SPEC HostilReference : public Reference +class MANGOS_DLL_SPEC HostileReference : public Reference { public: - HostilReference(Unit* pUnit, ThreatManager *pThreatManager, float pThreat); + HostileReference(Unit* pUnit, ThreatManager *pThreatManager, float pThreat); //================================================= void addThreat(float pMod); @@ -86,7 +86,7 @@ class MANGOS_DLL_SPEC 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(); } //================================================= @@ -99,7 +99,7 @@ class MANGOS_DLL_SPEC HostilReference : public Reference //================================================= - HostilReference* next() { return ((HostilReference* ) Reference::next()); } + HostileReference* next() { return ((HostileReference* ) Reference::next()); } //================================================= @@ -130,13 +130,13 @@ class ThreatManager; class MANGOS_DLL_SPEC 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(); @@ -144,11 +144,11 @@ class MANGOS_DLL_SPEC ThreatContainer ThreatContainer() { iDirty = false; } ~ThreatContainer() { clearReferences(); } - HostilReference* addThreat(Unit* pVictim, float pThreat); + HostileReference* addThreat(Unit* pVictim, float pThreat); void modifyThreatPercent(Unit *pVictim, int32 percent); - HostilReference* selectNextVictim(Creature* pAttacker, HostilReference* pCurrentVictim); + HostileReference* selectNextVictim(Creature* pAttacker, HostileReference* pCurrentVictim); void setDirty(bool pDirty) { iDirty = pDirty; } @@ -156,11 +156,11 @@ class MANGOS_DLL_SPEC 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; } }; //================================================= @@ -168,7 +168,7 @@ class MANGOS_DLL_SPEC ThreatContainer class MANGOS_DLL_SPEC ThreatManager { public: - friend class HostilReference; + friend class HostileReference; explicit ThreatManager(Unit *pOwner); @@ -185,27 +185,27 @@ class MANGOS_DLL_SPEC ThreatManager void processThreatEvent(ThreatRefStatusChangeEvent* threatRefStatusChangeEvent); - HostilReference* getCurrentVictim() { return iCurrentVictim; } + HostileReference* getCurrentVictim() { return iCurrentVictim; } Unit* getOwner() { return iOwner; } - Unit* getHostilTarget(); + Unit* getHostileTarget(); void tauntApply(Unit* pTaunter); void tauntFadeOut(Unit *pTaunter); - void setCurrentVictim(HostilReference* pHostilReference); + void setCurrentVictim(HostileReference* pHostileReference); void setDirty(bool pDirty) { iThreatContainer.setDirty(pDirty); } // methods to access the lists from the outside to do sume 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: - HostilReference* iCurrentVictim; + HostileReference* iCurrentVictim; Unit* iOwner; ThreatContainer iThreatContainer; ThreatContainer iThreatOfflineContainer; diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 3cfc0a3c1..23c0cac95 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -71,7 +71,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) { m_objectType |= TYPEMASK_UNIT; m_objectTypeId = TYPEID_UNIT; @@ -211,7 +211,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 ) @@ -576,7 +576,7 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa // stop combat pVictim->CombatStop(); - pVictim->getHostilRefManager().deleteReferences(); + pVictim->getHostileRefManager().deleteReferences(); bool damageFromSpiritOfRedemtionTalent = spellProto && spellProto->Id == 27795; @@ -10253,7 +10253,7 @@ void Unit::TauntFadeOut(Unit *taunter) } m_ThreatManager.tauntFadeOut(taunter); - target = m_ThreatManager.getHostilTarget(); + target = m_ThreatManager.getHostileTarget(); if (target && target != taunter) { @@ -10265,7 +10265,7 @@ void Unit::TauntFadeOut(Unit *taunter) //====================================================================== -bool Unit::SelectHostilTarget() +bool Unit::SelectHostileTarget() { //function provides main threat functionality //next-victim-selection algorithm and evade mode are called @@ -10312,7 +10312,7 @@ bool Unit::SelectHostilTarget() if ( !target && !m_ThreatManager.isThreatListEmpty() ) // No taunt aura or taunt aura caster is dead standart target selection - target = m_ThreatManager.getHostilTarget(); + target = m_ThreatManager.getHostileTarget(); if(target) { @@ -11005,7 +11005,7 @@ void Unit::CleanupsBeforeDelete() CombatStop(); ClearComboPointHolders(); DeleteThreatList(); - getHostilRefManager().setOnlineOfflineState(false); + getHostileRefManager().setOnlineOfflineState(false); RemoveAllAuras(); RemoveAllGameObjects(); RemoveAllDynObjects(); @@ -11793,7 +11793,7 @@ void Unit::SetFeignDeath(bool apply, uint64 const& casterGUID, uint32 spellID) if (casterGUID == GetGUID()) FinishSpell(CURRENT_GENERIC_SPELL,false); InterruptNonMeleeSpells(true); - getHostilRefManager().deleteReferences(); + getHostileRefManager().deleteReferences(); } else { diff --git a/src/game/Unit.h b/src/game/Unit.h index 7d58de8b4..72017fc1b 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -1338,13 +1338,13 @@ class MANGOS_DLL_SPEC Unit : public WorldObject void AddThreat(Unit* pVictim, float threat, SpellSchoolMask schoolMask = SPELL_SCHOOL_MASK_NORMAL, SpellEntry const *threatSpell = NULL); float ApplyTotalThreatModifier(float threat, SpellSchoolMask schoolMask = SPELL_SCHOOL_MASK_NORMAL); void DeleteThreatList(); - bool SelectHostilTarget(); + bool SelectHostileTarget(); 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; } uint32 GetVisibleAura(uint8 slot) { @@ -1580,7 +1580,7 @@ class MANGOS_DLL_SPEC 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/UnitEvents.h b/src/game/UnitEvents.h index 3f42afd9f..a72b15369 100644 --- a/src/game/UnitEvents.h +++ b/src/game/UnitEvents.h @@ -23,7 +23,7 @@ class ThreatContainer; class ThreatManager; -class HostilReference; +class HostileReference; //============================================================== //============================================================== @@ -85,7 +85,7 @@ class MANGOS_DLL_SPEC UnitBaseEvent class MANGOS_DLL_SPEC ThreatRefStatusChangeEvent : public UnitBaseEvent { private: - HostilReference* iHostilReference; + HostileReference* iHostileReference; union { float iFValue; @@ -94,13 +94,13 @@ class MANGOS_DLL_SPEC 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; } @@ -110,7 +110,7 @@ class MANGOS_DLL_SPEC 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; } @@ -125,7 +125,7 @@ class MANGOS_DLL_SPEC 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 00d8f4804..db6c459e7 100644 --- a/src/game/WaypointMovementGenerator.cpp +++ b/src/game/WaypointMovementGenerator.cpp @@ -233,7 +233,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); @@ -258,7 +258,7 @@ void FlightPathMovementGenerator::Finalize(Player & player) if(player.m_taxi.empty()) { - player.getHostilRefManager().setOnlineOfflineState(true); + player.getHostileRefManager().setOnlineOfflineState(true); if(player.pvpInfo.inHostileArea) player.CastSpell(&player, 2479, true); diff --git a/src/game/WorldSession.cpp b/src/game/WorldSession.cpp index 3a7c61181..30cba2c24 100644 --- a/src/game/WorldSession.cpp +++ b/src/game/WorldSession.cpp @@ -297,14 +297,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/shared/revision_nr.h b/src/shared/revision_nr.h index 654a25367..eb7d12dce 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8641" + #define REVISION_NR "8642" #endif // __REVISION_NR_H__