Merge pull request #14103 from Epicurus4/6.x

Added a player searcher
This commit is contained in:
Duarte Duarte
2015-02-22 05:49:39 +00:00
4 changed files with 14 additions and 0 deletions

View File

@@ -677,3 +677,8 @@ void GetGameObjectListWithEntryInGrid(std::list<GameObject*>& list, WorldObject*
{
source->GetGameObjectListWithEntryInGrid(list, entry, maxSearchRange);
}
void GetPlayerListInGrid(std::list<Player*>& list, WorldObject* source, float maxSearchRange)
{
source->GetPlayerListInGrid(list, maxSearchRange);
}

View File

@@ -423,5 +423,6 @@ Creature* GetClosestCreatureWithEntry(WorldObject* source, uint32 entry, float m
GameObject* GetClosestGameObjectWithEntry(WorldObject* source, uint32 entry, float maxSearchRange);
void GetCreatureListWithEntryInGrid(std::list<Creature*>& list, WorldObject* source, uint32 entry, float maxSearchRange);
void GetGameObjectListWithEntryInGrid(std::list<GameObject*>& list, WorldObject* source, uint32 entry, float maxSearchRange);
void GetPlayerListInGrid(std::list<Player*>& list, WorldObject* source, float maxSearchRange);
#endif // SCRIPTEDCREATURE_H_

View File

@@ -2696,6 +2696,13 @@ void WorldObject::GetCreatureListWithEntryInGrid(std::list<Creature*>& creatureL
cell.Visit(pair, visitor, *(this->GetMap()), *this, maxSearchRange);
}
void WorldObject::GetPlayerListInGrid(std::list<Player*>& playerList, float maxSearchRange) const
{
Trinity::AnyPlayerInObjectRangeCheck checker(this, maxSearchRange);
Trinity::PlayerListSearcher<Trinity::AnyPlayerInObjectRangeCheck> searcher(this, playerList, checker);
this->VisitNearbyWorldObject(maxSearchRange, searcher);
}
/*
namespace Trinity
{

View File

@@ -712,6 +712,7 @@ class WorldObject : public Object, public WorldLocation
void GetGameObjectListWithEntryInGrid(std::list<GameObject*>& lList, uint32 uiEntry, float fMaxSearchRange) const;
void GetCreatureListWithEntryInGrid(std::list<Creature*>& lList, uint32 uiEntry, float fMaxSearchRange) const;
void GetPlayerListInGrid(std::list<Player*>& lList, float fMaxSearchRange) const;
void DestroyForNearbyPlayers();
virtual void UpdateObjectVisibility(bool forced = true);