Core/Movement: Use SetWalk(true/false) instead of AddUnit/RemoveUnit.

This commit is contained in:
Venugh
2012-02-23 11:50:58 +01:00
parent 9219625243
commit 1cac01b3df
50 changed files with 131 additions and 122 deletions
@@ -307,11 +307,7 @@ void npc_escortAI::MovementInform(uint32 moveType, uint32 pointId)
{
sLog->outDebug(LOG_FILTER_TSCR, "TSCR: EscortAI has returned to original position before combat");
if (m_bIsRunning && me->HasUnitMovementFlag(MOVEMENTFLAG_WALKING))
me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING);
else if (!m_bIsRunning && !me->HasUnitMovementFlag(MOVEMENTFLAG_WALKING))
me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING);
me->SetWalk(!m_bIsRunning);
RemoveEscortState(STATE_ESCORT_RETURNING);
if (!m_uiWPWaitTimer)
@@ -400,14 +396,14 @@ void npc_escortAI::SetRun(bool on)
if (on)
{
if (!m_bIsRunning)
me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING);
me->SetWalk(false);
else
sLog->outDebug(LOG_FILTER_TSCR, "TSCR: EscortAI attempt to set run mode, but is already running.");
}
else
{
if (m_bIsRunning)
me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING);
me->SetWalk(true);
else
sLog->outDebug(LOG_FILTER_TSCR, "TSCR: EscortAI attempt to set walk mode, but is already walking.");
}
@@ -473,9 +469,9 @@ void npc_escortAI::Start(bool isActiveAttacker /* = true*/, bool run /* = false
//Set initial speed
if (m_bIsRunning)
me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING);
me->SetWalk(false);
else
me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING);
me->SetWalk(true);
AddEscortState(STATE_ESCORT_ESCORTING);
}
+3 -3
View File
@@ -45,7 +45,7 @@ SmartAI::SmartAI(Creature* c) : CreatureAI(c)
mCanRepeatPath = false;
// spawn in run mode
me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING);
me->SetWalk(false);
mRun = false;
me->GetPosition(&mLastOOCPos);
@@ -720,9 +720,9 @@ uint64 SmartAI::GetGUID(int32 /*id*/)
void SmartAI::SetRun(bool run)
{
if (run)
me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING);
me->SetWalk(false);
else
me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING);
me->SetWalk(true);
mRun = run;
}