*Add function FindNearestCreature and FindNearestGameObject to replace old FindCreature and FindGameObject

--HG--
branch : trunk
This commit is contained in:
megamage
2009-05-29 16:49:28 -05:00
parent 3faa712d42
commit 89f4c1c444
22 changed files with 69 additions and 94 deletions
@@ -507,28 +507,6 @@ void ScriptedAI::DoTeleportAll(float x, float y, float z, float o)
i_pl->TeleportTo(m_creature->GetMapId(), x, y, z, o, TELE_TO_NOT_LEAVE_COMBAT);
}
Unit* FindCreature(uint32 entry, float range, Unit* Finder)
{
if(!Finder)
return NULL;
Creature* target = NULL;
Trinity::AllCreaturesOfEntryInRange check(Finder, entry, range);
Trinity::CreatureSearcher<Trinity::AllCreaturesOfEntryInRange> searcher(Finder, target, check);
Finder->VisitNearbyObject(range, searcher);
return target;
}
GameObject* FindGameObject(uint32 entry, float range, Unit* Finder)
{
if(!Finder)
return NULL;
GameObject* target = NULL;
Trinity::AllGameObjectsWithEntryInGrid go_check(entry);
Trinity::GameObjectSearcher<Trinity::AllGameObjectsWithEntryInGrid> searcher(Finder, target, go_check);
Finder->VisitNearbyGridObject(range, searcher);
return target;
}
Unit* ScriptedAI::DoSelectLowestHpFriendly(float range, uint32 MinHPDiff)
{
Unit* pUnit = NULL;
@@ -29,13 +29,6 @@ class SummonList : private std::list<uint64>
Creature *m_creature;
};
//Get a single creature of given entry
Unit* FindCreature(uint32 entry, float range, Unit* Finder);
//Get a single gameobject of given entry
GameObject* FindGameObject(uint32 entry, float range, Unit* Finder);
struct PointMovement
{
uint32 m_uiCreatureEntry;