mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 07:37:01 +00:00
[11000] Minor code style changes for readability in aggro related unit functions
Signed-off-by: NoFantasy <nofantasy@nf.no>
This commit is contained in:
parent
e9fc7d05b2
commit
d38539f12a
2 changed files with 28 additions and 21 deletions
|
|
@ -8501,6 +8501,7 @@ void Unit::SetDeathState(DeathState s)
|
||||||
######## AGGRO SYSTEM ########
|
######## AGGRO SYSTEM ########
|
||||||
######## ########
|
######## ########
|
||||||
########################################*/
|
########################################*/
|
||||||
|
|
||||||
bool Unit::CanHaveThreatList() const
|
bool Unit::CanHaveThreatList() const
|
||||||
{
|
{
|
||||||
// only creatures can have threat list
|
// only creatures can have threat list
|
||||||
|
|
@ -8562,6 +8563,7 @@ void Unit::DeleteThreatList()
|
||||||
{
|
{
|
||||||
if (CanHaveThreatList() && !m_ThreatManager.isThreatListEmpty())
|
if (CanHaveThreatList() && !m_ThreatManager.isThreatListEmpty())
|
||||||
SendThreatClear();
|
SendThreatClear();
|
||||||
|
|
||||||
m_ThreatManager.clearReferences();
|
m_ThreatManager.clearReferences();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -8578,10 +8580,12 @@ void Unit::TauntApply(Unit* taunter)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Unit *target = getVictim();
|
Unit *target = getVictim();
|
||||||
|
|
||||||
if (target && target == taunter)
|
if (target && target == taunter)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SetInFront(taunter);
|
SetInFront(taunter);
|
||||||
|
|
||||||
if (((Creature*)this)->AI())
|
if (((Creature*)this)->AI())
|
||||||
((Creature*)this)->AI()->AttackStart(taunter);
|
((Creature*)this)->AI()->AttackStart(taunter);
|
||||||
|
|
||||||
|
|
@ -8601,6 +8605,7 @@ void Unit::TauntFadeOut(Unit *taunter)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Unit *target = getVictim();
|
Unit *target = getVictim();
|
||||||
|
|
||||||
if (!target || target != taunter)
|
if (!target || target != taunter)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -8621,6 +8626,7 @@ void Unit::TauntFadeOut(Unit *taunter)
|
||||||
if (target && target != taunter)
|
if (target && target != taunter)
|
||||||
{
|
{
|
||||||
SetInFront(target);
|
SetInFront(target);
|
||||||
|
|
||||||
if (((Creature*)this)->AI())
|
if (((Creature*)this)->AI())
|
||||||
((Creature*)this)->AI()->AttackStart(target);
|
((Creature*)this)->AI()->AttackStart(target);
|
||||||
}
|
}
|
||||||
|
|
@ -8638,6 +8644,7 @@ bool Unit::SelectHostileTarget()
|
||||||
|
|
||||||
if (!this->isAlive())
|
if (!this->isAlive())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
//This function only useful once AI has been initialized
|
//This function only useful once AI has been initialized
|
||||||
if (!((Creature*)this)->AI())
|
if (!((Creature*)this)->AI())
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -8663,8 +8670,8 @@ bool Unit::SelectHostileTarget()
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
--aura;
|
--aura;
|
||||||
if ( (caster = (*aura)->GetCaster()) &&
|
if ((caster = (*aura)->GetCaster()) && caster->IsInMap(this) &&
|
||||||
caster->IsInMap(this) && caster->isTargetableForAttack() && caster->isInAccessablePlaceFor((Creature*)this) )
|
caster->isTargetableForAttack() && caster->isInAccessablePlaceFor((Creature*)this))
|
||||||
{
|
{
|
||||||
target = caster;
|
target = caster;
|
||||||
break;
|
break;
|
||||||
|
|
@ -8673,8 +8680,8 @@ bool Unit::SelectHostileTarget()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// No taunt aura or taunt aura caster is dead, standard target selection
|
||||||
if (!target && !m_ThreatManager.isThreatListEmpty())
|
if (!target && !m_ThreatManager.isThreatListEmpty())
|
||||||
// No taunt aura or taunt aura caster is dead standart target selection
|
|
||||||
target = m_ThreatManager.getHostileTarget();
|
target = m_ThreatManager.getHostileTarget();
|
||||||
|
|
||||||
if (target)
|
if (target)
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "10999"
|
#define REVISION_NR "11000"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue