diff options
author | maximius <none@none> | 2009-10-23 23:29:45 -0700 |
---|---|---|
committer | maximius <none@none> | 2009-10-23 23:29:45 -0700 |
commit | 431ddb79917ce50d576820007f0672e7b4c386d3 (patch) | |
tree | 7d1b1959626e5bfea36348e83605f1c5f4ae544c /src | |
parent | c9cd2f2dbeeb09c78b43b73d77254543b301928f (diff) |
*Minor optimization
--HG--
branch : trunk
Diffstat (limited to 'src')
-rw-r--r-- | src/game/Creature.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp index 7f5af5f354b..edfa4d25c0a 100644 --- a/src/game/Creature.cpp +++ b/src/game/Creature.cpp @@ -2187,19 +2187,19 @@ bool Creature::_IsTargetAcceptable(const Unit *target) const { assert(target); - const Unit *myVictim = getAttackerForHelper(); - const Unit *targetVictim = target->getAttackerForHelper(); - // if the target cannot be attacked, the target is not acceptable if (!canAttack(target, true)) return false; + const Unit *myVictim = getAttackerForHelper(); + const Unit *targetVictim = target->getAttackerForHelper(); + // if I'm already fighting target, or I'm hostile towards the target, the target is acceptable if (myVictim == target || targetVictim == this || IsHostileTo(target)) return true; // if the target's victim is friendly, and the target is neutral, the target is acceptable - if (targetVictim && IsFriendlyTo(targetVictim) && !IsFriendlyTo(target)) + if (targetVictim && IsFriendlyTo(targetVictim))// && !IsFriendlyTo(target)) <- already handled in !canAttack(target, true) return true; // if the target's victim is not friendly, or the target is friendly, the target is not acceptable |