Core/SAI: Fix an issue where SAI was ignoring civilian and passive unit flags

Closes #2526
Disclaimer: This was not thoroughly tested; report any issue caused by this change.
This commit is contained in:
Nay
2011-10-01 16:29:23 +01:00
parent 269274f347
commit 0f7d9e4837
2 changed files with 3 additions and 7 deletions
+3 -3
View File
@@ -469,6 +469,9 @@ void SmartAI::MoveInLineOfSight(Unit* who)
if (!CanAIAttack(who)) if (!CanAIAttack(who))
return; return;
if (!me->canStartAttack(who, false))
return;
if (me->IsHostileTo(who)) if (me->IsHostileTo(who))
{ {
@@ -487,9 +490,6 @@ void SmartAI::MoveInLineOfSight(Unit* who)
} }
} }
} }
//if (me->canStartAttack(who, false))
// AttackStart(who);
} }
bool SmartAI::CanAIAttack(const Unit* /*who*/) const bool SmartAI::CanAIAttack(const Unit* /*who*/) const
@@ -1025,15 +1025,11 @@ namespace Trinity
return false; return false;
if (m_force) if (m_force)
{
if (!me->IsValidAttackTarget(u)) if (!me->IsValidAttackTarget(u))
return false; return false;
}
else else
{
if (!me->canStartAttack(u, false)) if (!me->canStartAttack(u, false))
return false; return false;
}
m_range = me->GetDistance(u); // use found unit range as new range limit for next check m_range = me->GetDistance(u); // use found unit range as new range limit for next check
return true; return true;