refactor(Core): Rename ...Manager to ...Mgr (#6910)
* Rename MapManager.h to MapMgr.h * Rename BanManager.h to BanMgr.h * Rename MapManager.cpp to MapMgr.cpp * Rename BanManager.cpp to BanMgr.cpp * Rename MapRefManager.h to MapRefMgr.h * Rename ThreatManager.h to ThreatMgr.h * Rename GridRefManager.h to GridRefMgr.h * Rename ThreatManager.cpp to ThreatMgr.cpp * Rename GroupRefManager.h to GroupRefMgr.h * Rename HostileRefManager.h to HostileRefMgr.h * Rename HostileRefManager.cpp to HostileRefMgr.cpp * Rename MMapManager.h to MMapMgr.h * Rename FollowerRefManager.h to FollowerRefMgr.h * Rename VMapManager2.h to VMapMgr2.h * Rename IVMapManager.h to IVMapMgr.h * Rename MMapManager.cpp to MMapMgr.cpp * Rename VMapManager2.cpp to VMapMgr2.cpp * Rename RefManager.h to RefMgr.h * Rename WaypointManager.h to WaypointMgr.h * Rename WaypointManager.cpp to WaypointMgr.cpp * Rename MPQManager.h to MPQMgr.h * Rename MPQManager.cpp to MPQMgr.cpp * Rename IMMAPManager.h to IMMAPMgr.h * fix build * Update Main.cpp * chore(Core/Misc): Remove toxic language * Revert "chore(Core/Misc): Remove toxic language" * fix build * build
This commit is contained in:
+14
-14
@@ -4,13 +4,13 @@
|
||||
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
|
||||
*/
|
||||
|
||||
#include "HostileRefManager.h"
|
||||
#include "HostileRefMgr.h"
|
||||
#include "SpellInfo.h"
|
||||
#include "SpellMgr.h"
|
||||
#include "ThreatManager.h"
|
||||
#include "ThreatMgr.h"
|
||||
#include "Unit.h"
|
||||
|
||||
HostileRefManager::~HostileRefManager()
|
||||
HostileRefMgr::~HostileRefMgr()
|
||||
{
|
||||
deleteReferences();
|
||||
}
|
||||
@@ -20,7 +20,7 @@ HostileRefManager::~HostileRefManager()
|
||||
// The victim is hated than by them as well
|
||||
// use for buffs and healing threat functionality
|
||||
|
||||
void HostileRefManager::threatAssist(Unit* victim, float baseThreat, SpellInfo const* threatSpell)
|
||||
void HostileRefMgr::threatAssist(Unit* victim, float baseThreat, SpellInfo const* threatSpell)
|
||||
{
|
||||
if (getSize() == 0)
|
||||
return;
|
||||
@@ -39,7 +39,7 @@ void HostileRefManager::threatAssist(Unit* victim, float baseThreat, SpellInfo c
|
||||
|
||||
//=================================================
|
||||
|
||||
void HostileRefManager::addTempThreat(float threat, bool apply)
|
||||
void HostileRefMgr::addTempThreat(float threat, bool apply)
|
||||
{
|
||||
HostileReference* ref = getFirst();
|
||||
|
||||
@@ -59,7 +59,7 @@ void HostileRefManager::addTempThreat(float threat, bool apply)
|
||||
|
||||
//=================================================
|
||||
|
||||
void HostileRefManager::addThreatPercent(int32 percent)
|
||||
void HostileRefMgr::addThreatPercent(int32 percent)
|
||||
{
|
||||
HostileReference* ref = getFirst();
|
||||
while (ref)
|
||||
@@ -72,7 +72,7 @@ void HostileRefManager::addThreatPercent(int32 percent)
|
||||
//=================================================
|
||||
// The online / offline status is given to the method. The calculation has to be done before
|
||||
|
||||
void HostileRefManager::setOnlineOfflineState(bool isOnline)
|
||||
void HostileRefMgr::setOnlineOfflineState(bool isOnline)
|
||||
{
|
||||
HostileReference* ref = getFirst();
|
||||
while (ref)
|
||||
@@ -85,7 +85,7 @@ void HostileRefManager::setOnlineOfflineState(bool isOnline)
|
||||
//=================================================
|
||||
// The online / offline status is calculated and set
|
||||
|
||||
void HostileRefManager::updateThreatTables()
|
||||
void HostileRefMgr::updateThreatTables()
|
||||
{
|
||||
HostileReference* ref = getFirst();
|
||||
while (ref)
|
||||
@@ -99,7 +99,7 @@ void HostileRefManager::updateThreatTables()
|
||||
// The references are not needed anymore
|
||||
// tell the source to remove them from the list and free the mem
|
||||
|
||||
void HostileRefManager::deleteReferences()
|
||||
void HostileRefMgr::deleteReferences()
|
||||
{
|
||||
HostileReference* ref = getFirst();
|
||||
while (ref)
|
||||
@@ -114,7 +114,7 @@ void HostileRefManager::deleteReferences()
|
||||
//=================================================
|
||||
// delete one reference, defined by faction
|
||||
|
||||
void HostileRefManager::deleteReferencesForFaction(uint32 faction)
|
||||
void HostileRefMgr::deleteReferencesForFaction(uint32 faction)
|
||||
{
|
||||
HostileReference* ref = getFirst();
|
||||
while (ref)
|
||||
@@ -132,7 +132,7 @@ void HostileRefManager::deleteReferencesForFaction(uint32 faction)
|
||||
//=================================================
|
||||
// delete one reference, defined by Unit
|
||||
|
||||
void HostileRefManager::deleteReference(Unit* creature)
|
||||
void HostileRefMgr::deleteReference(Unit* creature)
|
||||
{
|
||||
HostileReference* ref = getFirst();
|
||||
while (ref)
|
||||
@@ -151,7 +151,7 @@ void HostileRefManager::deleteReference(Unit* creature)
|
||||
//=================================================
|
||||
// delete all references out of specified range
|
||||
|
||||
void HostileRefManager::deleteReferencesOutOfRange(float range)
|
||||
void HostileRefMgr::deleteReferencesOutOfRange(float range)
|
||||
{
|
||||
HostileReference* ref = getFirst();
|
||||
range = range * range;
|
||||
@@ -171,7 +171,7 @@ void HostileRefManager::deleteReferencesOutOfRange(float range)
|
||||
//=================================================
|
||||
// set state for one reference, defined by Unit
|
||||
|
||||
void HostileRefManager::setOnlineOfflineState(Unit* creature, bool isOnline)
|
||||
void HostileRefMgr::setOnlineOfflineState(Unit* creature, bool isOnline)
|
||||
{
|
||||
HostileReference* ref = getFirst();
|
||||
while (ref)
|
||||
@@ -188,7 +188,7 @@ void HostileRefManager::setOnlineOfflineState(Unit* creature, bool isOnline)
|
||||
|
||||
//=================================================
|
||||
|
||||
void HostileRefManager::UpdateVisibility(bool checkThreat)
|
||||
void HostileRefMgr::UpdateVisibility(bool checkThreat)
|
||||
{
|
||||
HostileReference* ref = getFirst();
|
||||
while (ref)
|
||||
@@ -8,22 +8,22 @@
|
||||
#define _HOSTILEREFMANAGER
|
||||
|
||||
#include "Common.h"
|
||||
#include "RefManager.h"
|
||||
#include "RefMgr.h"
|
||||
|
||||
class Unit;
|
||||
class ThreatManager;
|
||||
class ThreatMgr;
|
||||
class HostileReference;
|
||||
class SpellInfo;
|
||||
|
||||
//=================================================
|
||||
|
||||
class HostileRefManager : public RefManager<Unit, ThreatManager>
|
||||
class HostileRefMgr : public RefMgr<Unit, ThreatMgr>
|
||||
{
|
||||
private:
|
||||
Unit* iOwner;
|
||||
public:
|
||||
explicit HostileRefManager(Unit* owner) { iOwner = owner; }
|
||||
~HostileRefManager() override;
|
||||
explicit HostileRefMgr(Unit* owner) { iOwner = owner; }
|
||||
~HostileRefMgr() override;
|
||||
|
||||
Unit* GetOwner() { return iOwner; }
|
||||
|
||||
@@ -46,7 +46,7 @@ public:
|
||||
// pussywizard: for combat bugs
|
||||
void deleteReferencesOutOfRange(float range);
|
||||
|
||||
HostileReference* getFirst() { return ((HostileReference*) RefManager<Unit, ThreatManager>::getFirst()); }
|
||||
HostileReference* getFirst() { return ((HostileReference*) RefMgr<Unit, ThreatMgr>::getFirst()); }
|
||||
|
||||
void updateThreatTables();
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include "SpellAuras.h"
|
||||
#include "SpellInfo.h"
|
||||
#include "SpellMgr.h"
|
||||
#include "ThreatManager.h"
|
||||
#include "ThreatMgr.h"
|
||||
#include "Unit.h"
|
||||
#include "UnitEvents.h"
|
||||
|
||||
@@ -80,11 +80,11 @@ bool ThreatCalcHelper::isValidProcess(Unit* hatedUnit, Unit* hatingUnit, SpellIn
|
||||
//================= HostileReference ==========================
|
||||
//============================================================
|
||||
|
||||
HostileReference::HostileReference(Unit* refUnit, ThreatManager* threatManager, float threat)
|
||||
HostileReference::HostileReference(Unit* refUnit, ThreatMgr* threatMgr, float threat)
|
||||
{
|
||||
iThreat = threat;
|
||||
iTempThreatModifier = 0.0f;
|
||||
link(refUnit, threatManager);
|
||||
link(refUnit, threatMgr);
|
||||
iUnitGuid = refUnit->GetGUID();
|
||||
iOnline = true;
|
||||
}
|
||||
@@ -382,16 +382,16 @@ HostileReference* ThreatContainer::selectNextVictim(Creature* attacker, HostileR
|
||||
}
|
||||
|
||||
//============================================================
|
||||
//=================== ThreatManager ==========================
|
||||
//=================== ThreatMgr ==========================
|
||||
//============================================================
|
||||
|
||||
ThreatManager::ThreatManager(Unit* owner) : iCurrentVictim(nullptr), iOwner(owner), iUpdateTimer(THREAT_UPDATE_INTERVAL)
|
||||
ThreatMgr::ThreatMgr(Unit* owner) : iCurrentVictim(nullptr), iOwner(owner), iUpdateTimer(THREAT_UPDATE_INTERVAL)
|
||||
{
|
||||
}
|
||||
|
||||
//============================================================
|
||||
|
||||
void ThreatManager::clearReferences()
|
||||
void ThreatMgr::clearReferences()
|
||||
{
|
||||
iThreatContainer.clearReferences();
|
||||
iThreatOfflineContainer.clearReferences();
|
||||
@@ -401,7 +401,7 @@ void ThreatManager::clearReferences()
|
||||
|
||||
//============================================================
|
||||
|
||||
void ThreatManager::addThreat(Unit* victim, float threat, SpellSchoolMask schoolMask, SpellInfo const* threatSpell)
|
||||
void ThreatMgr::addThreat(Unit* victim, float threat, SpellSchoolMask schoolMask, SpellInfo const* threatSpell)
|
||||
{
|
||||
if (!ThreatCalcHelper::isValidProcess(victim, GetOwner(), threatSpell))
|
||||
return;
|
||||
@@ -409,7 +409,7 @@ void ThreatManager::addThreat(Unit* victim, float threat, SpellSchoolMask school
|
||||
doAddThreat(victim, ThreatCalcHelper::calcThreat(victim, iOwner, threat, schoolMask, threatSpell));
|
||||
}
|
||||
|
||||
void ThreatManager::doAddThreat(Unit* victim, float threat)
|
||||
void ThreatMgr::doAddThreat(Unit* victim, float threat)
|
||||
{
|
||||
uint32 redirectThreadPct = victim->GetRedirectThreatPercent();
|
||||
|
||||
@@ -428,7 +428,7 @@ void ThreatManager::doAddThreat(Unit* victim, float threat)
|
||||
_addThreat(victim, threat);
|
||||
}
|
||||
|
||||
void ThreatManager::_addThreat(Unit* victim, float threat)
|
||||
void ThreatMgr::_addThreat(Unit* victim, float threat)
|
||||
{
|
||||
HostileReference* ref = iThreatContainer.addThreat(victim, threat);
|
||||
// Ref is not in the online refs, search the offline refs next
|
||||
@@ -448,14 +448,14 @@ void ThreatManager::_addThreat(Unit* victim, float threat)
|
||||
|
||||
//============================================================
|
||||
|
||||
void ThreatManager::modifyThreatPercent(Unit* victim, int32 percent)
|
||||
void ThreatMgr::modifyThreatPercent(Unit* victim, int32 percent)
|
||||
{
|
||||
iThreatContainer.modifyThreatPercent(victim, percent);
|
||||
}
|
||||
|
||||
//============================================================
|
||||
|
||||
Unit* ThreatManager::getHostilTarget()
|
||||
Unit* ThreatMgr::getHostilTarget()
|
||||
{
|
||||
iThreatContainer.update();
|
||||
HostileReference* nextVictim = iThreatContainer.selectNextVictim(GetOwner()->ToCreature(), getCurrentVictim());
|
||||
@@ -465,7 +465,7 @@ Unit* ThreatManager::getHostilTarget()
|
||||
|
||||
//============================================================
|
||||
|
||||
float ThreatManager::getThreat(Unit* victim, bool alsoSearchOfflineList)
|
||||
float ThreatMgr::getThreat(Unit* victim, bool alsoSearchOfflineList)
|
||||
{
|
||||
float threat = 0.0f;
|
||||
HostileReference* ref = iThreatContainer.getReferenceByTarget(victim);
|
||||
@@ -478,7 +478,7 @@ float ThreatManager::getThreat(Unit* victim, bool alsoSearchOfflineList)
|
||||
|
||||
//============================================================
|
||||
|
||||
float ThreatManager::getThreatWithoutTemp(Unit* victim, bool alsoSearchOfflineList)
|
||||
float ThreatMgr::getThreatWithoutTemp(Unit* victim, bool alsoSearchOfflineList)
|
||||
{
|
||||
float threat = 0.0f;
|
||||
HostileReference* ref = iThreatContainer.getReferenceByTarget(victim);
|
||||
@@ -491,7 +491,7 @@ float ThreatManager::getThreatWithoutTemp(Unit* victim, bool alsoSearchOfflineLi
|
||||
|
||||
//============================================================
|
||||
|
||||
void ThreatManager::tauntApply(Unit* taunter)
|
||||
void ThreatMgr::tauntApply(Unit* taunter)
|
||||
{
|
||||
HostileReference* ref = iThreatContainer.getReferenceByTarget(taunter);
|
||||
if (getCurrentVictim() && ref && (ref->getThreat() < getCurrentVictim()->getThreat()))
|
||||
@@ -503,7 +503,7 @@ void ThreatManager::tauntApply(Unit* taunter)
|
||||
|
||||
//============================================================
|
||||
|
||||
void ThreatManager::tauntFadeOut(Unit* taunter)
|
||||
void ThreatMgr::tauntFadeOut(Unit* taunter)
|
||||
{
|
||||
HostileReference* ref = iThreatContainer.getReferenceByTarget(taunter);
|
||||
if (ref)
|
||||
@@ -512,7 +512,7 @@ void ThreatManager::tauntFadeOut(Unit* taunter)
|
||||
|
||||
//============================================================
|
||||
|
||||
void ThreatManager::setCurrentVictim(HostileReference* pHostileReference)
|
||||
void ThreatMgr::setCurrentVictim(HostileReference* pHostileReference)
|
||||
{
|
||||
if (pHostileReference && pHostileReference != iCurrentVictim)
|
||||
{
|
||||
@@ -525,9 +525,9 @@ void ThreatManager::setCurrentVictim(HostileReference* pHostileReference)
|
||||
// The hated unit is gone, dead or deleted
|
||||
// return true, if the event is consumed
|
||||
|
||||
void ThreatManager::processThreatEvent(ThreatRefStatusChangeEvent* threatRefStatusChangeEvent)
|
||||
void ThreatMgr::processThreatEvent(ThreatRefStatusChangeEvent* threatRefStatusChangeEvent)
|
||||
{
|
||||
threatRefStatusChangeEvent->setThreatManager(this); // now we can set the threat manager
|
||||
threatRefStatusChangeEvent->setThreatMgr(this); // now we can set the threat manager
|
||||
|
||||
HostileReference* hostilRef = threatRefStatusChangeEvent->getReference();
|
||||
|
||||
@@ -576,7 +576,7 @@ void ThreatManager::processThreatEvent(ThreatRefStatusChangeEvent* threatRefStat
|
||||
}
|
||||
}
|
||||
|
||||
bool ThreatManager::isNeedUpdateToClient(uint32 time)
|
||||
bool ThreatMgr::isNeedUpdateToClient(uint32 time)
|
||||
{
|
||||
if (isThreatListEmpty())
|
||||
return false;
|
||||
@@ -591,7 +591,7 @@ bool ThreatManager::isNeedUpdateToClient(uint32 time)
|
||||
}
|
||||
|
||||
// Reset all aggro without modifying the threatlist.
|
||||
void ThreatManager::resetAllAggro()
|
||||
void ThreatMgr::resetAllAggro()
|
||||
{
|
||||
ThreatContainer::StorageType& threatList = iThreatContainer.iThreatList;
|
||||
if (threatList.empty())
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
class Unit;
|
||||
class Creature;
|
||||
class ThreatManager;
|
||||
class ThreatMgr;
|
||||
class SpellInfo;
|
||||
|
||||
#define THREAT_UPDATE_INTERVAL 2 * IN_MILLISECONDS // Server should send threat update to client periodically each second
|
||||
@@ -32,10 +32,10 @@ struct ThreatCalcHelper
|
||||
};
|
||||
|
||||
//==============================================================
|
||||
class HostileReference : public Reference<Unit, ThreatManager>
|
||||
class HostileReference : public Reference<Unit, ThreatMgr>
|
||||
{
|
||||
public:
|
||||
HostileReference(Unit* refUnit, ThreatManager* threatManager, float threat);
|
||||
HostileReference(Unit* refUnit, ThreatMgr* threatMgr, float threat);
|
||||
|
||||
//=================================================
|
||||
void addThreat(float modThreat);
|
||||
@@ -93,7 +93,7 @@ public:
|
||||
|
||||
//=================================================
|
||||
|
||||
HostileReference* next() { return ((HostileReference*) Reference<Unit, ThreatManager>::next()); }
|
||||
HostileReference* next() { return ((HostileReference*) Reference<Unit, ThreatMgr>::next()); }
|
||||
|
||||
//=================================================
|
||||
|
||||
@@ -118,11 +118,11 @@ private:
|
||||
};
|
||||
|
||||
//==============================================================
|
||||
class ThreatManager;
|
||||
class ThreatMgr;
|
||||
|
||||
class ThreatContainer
|
||||
{
|
||||
friend class ThreatManager;
|
||||
friend class ThreatMgr;
|
||||
|
||||
public:
|
||||
typedef std::list<HostileReference*> StorageType;
|
||||
@@ -177,14 +177,14 @@ private:
|
||||
|
||||
//=================================================
|
||||
|
||||
class ThreatManager
|
||||
class ThreatMgr
|
||||
{
|
||||
public:
|
||||
friend class HostileReference;
|
||||
|
||||
explicit ThreatManager(Unit* owner);
|
||||
explicit ThreatMgr(Unit* owner);
|
||||
|
||||
~ThreatManager() { clearReferences(); }
|
||||
~ThreatMgr() { clearReferences(); }
|
||||
|
||||
void clearReferences();
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include "Common.h"
|
||||
|
||||
class ThreatContainer;
|
||||
class ThreatManager;
|
||||
class ThreatMgr;
|
||||
class HostileReference;
|
||||
|
||||
//==============================================================
|
||||
@@ -79,15 +79,15 @@ private:
|
||||
int32 iIValue;
|
||||
bool iBValue;
|
||||
};
|
||||
ThreatManager* iThreatManager;
|
||||
ThreatMgr* iThreatMgr;
|
||||
public:
|
||||
ThreatRefStatusChangeEvent(uint32 pType) : UnitBaseEvent(pType), iThreatManager(nullptr) { iHostileReference = nullptr; }
|
||||
ThreatRefStatusChangeEvent(uint32 pType) : UnitBaseEvent(pType), iThreatMgr(nullptr) { iHostileReference = nullptr; }
|
||||
|
||||
ThreatRefStatusChangeEvent(uint32 pType, HostileReference* pHostileReference) : UnitBaseEvent(pType), iThreatManager(nullptr) { iHostileReference = pHostileReference; }
|
||||
ThreatRefStatusChangeEvent(uint32 pType, HostileReference* pHostileReference) : UnitBaseEvent(pType), iThreatMgr(nullptr) { iHostileReference = pHostileReference; }
|
||||
|
||||
ThreatRefStatusChangeEvent(uint32 pType, HostileReference* pHostileReference, float pValue) : UnitBaseEvent(pType), iThreatManager(nullptr) { iHostileReference = pHostileReference; iFValue = pValue; }
|
||||
ThreatRefStatusChangeEvent(uint32 pType, HostileReference* pHostileReference, float pValue) : UnitBaseEvent(pType), iThreatMgr(nullptr) { iHostileReference = pHostileReference; iFValue = pValue; }
|
||||
|
||||
ThreatRefStatusChangeEvent(uint32 pType, HostileReference* pHostileReference, bool pValue) : UnitBaseEvent(pType), iThreatManager(nullptr) { iHostileReference = pHostileReference; iBValue = pValue; }
|
||||
ThreatRefStatusChangeEvent(uint32 pType, HostileReference* pHostileReference, bool pValue) : UnitBaseEvent(pType), iThreatMgr(nullptr) { iHostileReference = pHostileReference; iBValue = pValue; }
|
||||
|
||||
[[nodiscard]] int32 getIValue() const { return iIValue; }
|
||||
|
||||
@@ -99,20 +99,20 @@ public:
|
||||
|
||||
[[nodiscard]] HostileReference* getReference() const { return iHostileReference; }
|
||||
|
||||
void setThreatManager(ThreatManager* pThreatManager) { iThreatManager = pThreatManager; }
|
||||
void setThreatMgr(ThreatMgr* pThreatMgr) { iThreatMgr = pThreatMgr; }
|
||||
|
||||
[[nodiscard]] ThreatManager* getThreatManager() const { return iThreatManager; }
|
||||
[[nodiscard]] ThreatMgr* getThreatMgr() const { return iThreatMgr; }
|
||||
};
|
||||
|
||||
//==============================================================
|
||||
|
||||
class ThreatManagerEvent : public ThreatRefStatusChangeEvent
|
||||
class ThreatMgrEvent : public ThreatRefStatusChangeEvent
|
||||
{
|
||||
private:
|
||||
ThreatContainer* iThreatContainer;
|
||||
public:
|
||||
ThreatManagerEvent(uint32 pType) : ThreatRefStatusChangeEvent(pType), iThreatContainer(nullptr) {}
|
||||
ThreatManagerEvent(uint32 pType, HostileReference* pHostileReference) : ThreatRefStatusChangeEvent(pType, pHostileReference), iThreatContainer(nullptr) {}
|
||||
ThreatMgrEvent(uint32 pType) : ThreatRefStatusChangeEvent(pType), iThreatContainer(nullptr) {}
|
||||
ThreatMgrEvent(uint32 pType, HostileReference* pHostileReference) : ThreatRefStatusChangeEvent(pType, pHostileReference), iThreatContainer(nullptr) {}
|
||||
|
||||
void setThreatContainer(ThreatContainer* pThreatContainer) { iThreatContainer = pThreatContainer; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user