Core/Objects: Method to get nearest GO of type X, FindNearestGameObjectOfType

Thanks Subv for the idea
This commit is contained in:
Nay committed 2012-09-08 23:16:35 +01:00
1 parent 7dbc20626e
commit b30aeb8d51
3 files changed
+34

No files matched your search

@@ -2537,6 +2537,15 @@ GameObject* WorldObject::FindNearestGameObject(uint32 entry, float range) const
return go;
}
GameObject* WorldObject::FindNearestGameObjectOfType(GameobjectTypes type, float range) const
{
GameObject* go = NULL;
Trinity::NearestGameObjectTypeInObjectRangeCheck checker(*this, type, range);
Trinity::GameObjectLastSearcher<Trinity::NearestGameObjectTypeInObjectRangeCheck> searcher(this, go, checker);
VisitNearbyGridObject(range, searcher);
return go;
}
void WorldObject::GetGameObjectListWithEntryInGrid(std::list<GameObject*>& gameobjectList, uint32 entry, float maxSearchRange) const
{
CellCoord pair(Trinity::ComputeCellCoord(this->GetPositionX(), this->GetPositionY()));