Skip to content

Commit

Permalink
Core/SAI: Fix an issue where SAI was ignoring civilian and passive un…
Browse files Browse the repository at this point in the history
…it flags

Closes #2526
Disclaimer: This was not thoroughly tested; report any issue caused by this change.
  • Loading branch information
DDuarte committed Oct 1, 2011
1 parent 269274f commit 0f7d9e4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/server/game/AI/SmartScripts/SmartAI.cpp
Expand Up @@ -469,6 +469,9 @@ void SmartAI::MoveInLineOfSight(Unit* who)

if (!CanAIAttack(who))
return;

if (!me->canStartAttack(who, false))
return;

if (me->IsHostileTo(who))
{
Expand All @@ -487,9 +490,6 @@ void SmartAI::MoveInLineOfSight(Unit* who)
}
}
}

//if (me->canStartAttack(who, false))
// AttackStart(who);
}

bool SmartAI::CanAIAttack(const Unit* /*who*/) const
Expand Down
4 changes: 0 additions & 4 deletions src/server/game/Grids/Notifiers/GridNotifiers.h
Expand Up @@ -1025,15 +1025,11 @@ namespace Trinity
return false;

if (m_force)
{
if (!me->IsValidAttackTarget(u))
return false;
}
else

This comment has been minimized.

Copy link
@megamage

megamage Oct 3, 2011

By deleting "{}" this else is now coupled with "if (!me->IsValidAttackTarget(u))" instead of "if (m_force)". Is this your intention?

This comment has been minimized.

Copy link
@DDuarte

DDuarte Oct 3, 2011

Author Contributor

If that's true, that was not my intention. I will revert this asap.
Thanks for pointing it out :)

{
if (!me->canStartAttack(u, false))
return false;
}

m_range = me->GetDistance(u); // use found unit range as new range limit for next check
return true;
Expand Down

0 comments on commit 0f7d9e4

Please sign in to comment.