aboutsummaryrefslogtreecommitdiff
path: root/src/game/Unit.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/Unit.cpp')
-rw-r--r--src/game/Unit.cpp20
1 files changed, 3 insertions, 17 deletions
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index 19ea4029cf8..f3a0b56c1fa 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -12089,24 +12089,10 @@ void Unit::UpdateReactives( uint32 p_time )
Unit* Unit::SelectNearbyTarget(float dist) const
{
- CellPair p(Trinity::ComputeCellPair(GetPositionX(), GetPositionY()));
- Cell cell(p);
- cell.data.Part.reserved = ALL_DISTRICT;
- cell.SetNoCreate();
-
std::list<Unit *> targets;
-
- {
- Trinity::AnyUnfriendlyUnitInObjectRangeCheck u_check(this, this, dist);
- Trinity::UnitListSearcher<Trinity::AnyUnfriendlyUnitInObjectRangeCheck> searcher(targets, u_check);
-
- TypeContainerVisitor<Trinity::UnitListSearcher<Trinity::AnyUnfriendlyUnitInObjectRangeCheck>, WorldTypeMapContainer > world_unit_searcher(searcher);
- TypeContainerVisitor<Trinity::UnitListSearcher<Trinity::AnyUnfriendlyUnitInObjectRangeCheck>, GridTypeMapContainer > grid_unit_searcher(searcher);
-
- CellLock<GridReadGuard> cell_lock(cell, p);
- cell_lock->Visit(cell_lock, world_unit_searcher, *MapManager::Instance().GetMap(GetMapId(), this));
- cell_lock->Visit(cell_lock, grid_unit_searcher, *MapManager::Instance().GetMap(GetMapId(), this));
- }
+ Trinity::AnyUnfriendlyUnitInObjectRangeCheck u_check(this, this, dist);
+ Trinity::UnitListSearcher<Trinity::AnyUnfriendlyUnitInObjectRangeCheck> searcher(targets, u_check);
+ VisitNearbyObject(dist, searcher);
// remove current target
if(getVictim())