diff options
author | Drahy <none@none> | 2009-07-27 07:40:52 +0200 |
---|---|---|
committer | Drahy <none@none> | 2009-07-27 07:40:52 +0200 |
commit | afd5658de56d471f0e364f19ed13cccc84175d39 (patch) | |
tree | 55818fb43a749dad720dce1301b9aa68649863ec /src/game/Object.cpp | |
parent | 6a8484ce25f5f278f6546177c57eb74fa556dfd7 (diff) | |
parent | 190863e5a58364a9f42336e300c836d9ec6242ad (diff) |
* Merge
--HG--
branch : trunk
Diffstat (limited to 'src/game/Object.cpp')
-rw-r--r-- | src/game/Object.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/game/Object.cpp b/src/game/Object.cpp index 76041d8792c..d565818910e 100644 --- a/src/game/Object.cpp +++ b/src/game/Object.cpp @@ -1992,6 +1992,36 @@ GameObject* WorldObject::FindNearestGameObject(uint32 entry, float range) return go; } +void WorldObject::GetGameObjectListWithEntryInGrid(std::list<GameObject*>& lList, uint32 uiEntry, float fMaxSearchRange) +{ + CellPair pair(Trinity::ComputeCellPair(this->GetPositionX(), this->GetPositionY())); + Cell cell(pair); + cell.data.Part.reserved = ALL_DISTRICT; + cell.SetNoCreate(); + + Trinity::AllGameObjectsWithEntryInRange check(this, uiEntry, fMaxSearchRange); + Trinity::GameObjectListSearcher<Trinity::AllGameObjectsWithEntryInRange> searcher(this, lList, check); + TypeContainerVisitor<Trinity::GameObjectListSearcher<Trinity::AllGameObjectsWithEntryInRange>, GridTypeMapContainer> visitor(searcher); + + CellLock<GridReadGuard> cell_lock(cell, pair); + cell_lock->Visit(cell_lock, visitor, *(this->GetMap())); +} + +void WorldObject::GetCreatureListWithEntryInGrid(std::list<Creature*>& lList, uint32 uiEntry, float fMaxSearchRange) +{ + CellPair pair(Trinity::ComputeCellPair(this->GetPositionX(), this->GetPositionY())); + Cell cell(pair); + cell.data.Part.reserved = ALL_DISTRICT; + cell.SetNoCreate(); + + Trinity::AllCreaturesOfEntryInRange check(this, uiEntry, fMaxSearchRange); + Trinity::CreatureListSearcher<Trinity::AllCreaturesOfEntryInRange> searcher(this, lList, check); + TypeContainerVisitor<Trinity::CreatureListSearcher<Trinity::AllCreaturesOfEntryInRange>, GridTypeMapContainer> visitor(searcher); + + CellLock<GridReadGuard> cell_lock(cell, pair); + cell_lock->Visit(cell_lock, visitor, *(this->GetMap())); +} + /* namespace MaNGOS { |