Added a player searcher

This can be used in scripts to search for Player* objects within a given
range.
This commit is contained in:
Epicurus4
2015-02-10 22:16:07 -05:00
parent 36963f2442
commit 4ffdf3396d
4 changed files with 18 additions and 0 deletions

View File

@@ -2697,6 +2697,17 @@ 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
{
CellCoord pair(Trinity::ComputeCellCoord(this->GetPositionX(), this->GetPositionY()));
Cell cell(pair);
cell.SetNoCreate();
Trinity::AnyPlayerInObjectRangeCheck checker(this, maxSearchRange);
Trinity::PlayerListSearcher<Trinity::AnyPlayerInObjectRangeCheck> searcher(this, playerList, checker);
this->VisitNearbyWorldObject(maxSearchRange, searcher);
}
/*
namespace Trinity
{