[9208] Big cleanup in UNIT_STAT_* use

* Re-number enums by function groups and use where possible new defined masks in code instead raw enum |-lists.
* Avoid use movement generator generic state markers like UNIT_STAT_CONFUSED for mark movement stoped.
  Add special shadow UNIT_STAT_CONFUSED_MOVE/etc states for like use.
  UNIT_STAT_CONFUSED in like case will be safe expect use for normal checks confused state presence
  And UNIT_STAT_CONFUSED_MOVE for check real move in this state
This commit is contained in:
VladimirMangos 2010-01-18 10:48:31 +03:00
parent 7d6b1b292e
commit 6a2e8064f1
25 changed files with 251 additions and 104 deletions

View file

@ -75,7 +75,6 @@ void PetAI::AttackStart(Unit *u)
if(m_creature->Attack(u,true))
{
m_creature->clearUnitState(UNIT_STAT_FOLLOW);
// TMGs call CreatureRelocation which via MoveInLineOfSight can call this function
// thus with the following clear the original TMG gets invalidated and crash, doh
// hope it doesn't start to leak memory without this :-/
@ -126,8 +125,7 @@ void PetAI::_stopAttack()
}
else
{
m_creature->clearUnitState(UNIT_STAT_FOLLOW);
m_creature->GetMotionMaster()->Clear();
m_creature->GetMotionMaster()->Clear(false);
m_creature->GetMotionMaster()->MoveIdle();
}
m_creature->AttackStop();
@ -163,7 +161,7 @@ void PetAI::UpdateAI(const uint32 diff)
// required to be stopped cases
if (m_creature->IsStopped() && m_creature->IsNonMeleeSpellCasted(false))
{
if (m_creature->hasUnitState(UNIT_STAT_FOLLOW))
if (m_creature->hasUnitState(UNIT_STAT_FOLLOW_MOVE))
m_creature->InterruptNonMeleeSpells(false);
else
return;