aboutsummaryrefslogtreecommitdiff
path: root/src/game/Object.cpp
diff options
context:
space:
mode:
authormegamage <none@none>2009-05-29 16:49:28 -0500
committermegamage <none@none>2009-05-29 16:49:28 -0500
commit89f4c1c444b9a0b090d71667c26f05165394a594 (patch)
treeb70b3583bba1a1341f1e371e9a9a1956dc1377c0 /src/game/Object.cpp
parent3faa712d429fe5e352b73a6e5e524a2d1f4630d7 (diff)
*Add function FindNearestCreature and FindNearestGameObject to replace old FindCreature and FindGameObject
--HG-- branch : trunk
Diffstat (limited to 'src/game/Object.cpp')
-rw-r--r--src/game/Object.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/game/Object.cpp b/src/game/Object.cpp
index dd6b23e458f..99f2c0d8417 100644
--- a/src/game/Object.cpp
+++ b/src/game/Object.cpp
@@ -2041,6 +2041,24 @@ Creature* WorldObject::SummonTrigger(float x, float y, float z, float ang, uint3
return summon;
}
+Creature* WorldObject::FindNearestCreature(uint32 entry, float range, bool alive)
+{
+ Creature *creature = NULL;
+ Trinity::NearestCreatureEntryWithLiveStateInObjectRangeCheck checker(*this, entry, alive, range);
+ Trinity::CreatureLastSearcher<Trinity::NearestCreatureEntryWithLiveStateInObjectRangeCheck> searcher(this, creature, checker);
+ VisitNearbyObject(range, searcher);
+ return creature;
+}
+
+GameObject* WorldObject::FindNearestGameObject(uint32 entry, float range)
+{
+ GameObject *go = NULL;
+ Trinity::NearestGameObjectEntryInObjectRangeCheck checker(*this, entry, range);
+ Trinity::GameObjectLastSearcher<Trinity::NearestGameObjectEntryInObjectRangeCheck> searcher(this, go, checker);
+ VisitNearbyGridObject(range, searcher);
+ return go;
+}
+
/*
namespace MaNGOS
{