aboutsummaryrefslogtreecommitdiff
path: root/src/game/Creature.h
diff options
context:
space:
mode:
authorTrazom62 <none@none>2010-04-25 12:59:27 +0200
committerTrazom62 <none@none>2010-04-25 12:59:27 +0200
commiteccf5bf547c9b1648a453695189877c212071c70 (patch)
tree547c424a86c42bfd61944bc2d12d97f4146cec04 /src/game/Creature.h
parentb466819333eb551a64cdb02e9d8d25678fbb770e (diff)
Refactor Creature::SelectNearestTarget(float dist)
This function is used in many scripts to find the nearest enemy within the given distance. However, it had an implicit limit to the ATTACK_DISTANCE. so in many case the "dist" was in fact just ignored. In other case, the ATTACK_DISTANCE is required. So 2 functions are necessary to avoid ambiguities. The refactoring is the split of the function in 2: SelectNearestTarget and SelectNearestTargetInAttackDistance. --HG-- branch : trunk
Diffstat (limited to 'src/game/Creature.h')
-rw-r--r--src/game/Creature.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/game/Creature.h b/src/game/Creature.h
index 3ffaa5e401f..b2b51785956 100644
--- a/src/game/Creature.h
+++ b/src/game/Creature.h
@@ -557,6 +557,8 @@ class Creature : public Unit, public GridObject<Creature>
void SendAIReaction(AiReaction reactionType);
Unit* SelectNearestTarget(float dist = 0) const;
+ Unit* SelectNearestTargetInAttackDistance(float dist = 0) const;
+
void DoFleeToGetAssistance();
void CallForHelp(float fRadius);
void CallAssistance();