aboutsummaryrefslogtreecommitdiff
path: root/src/game/Creature.cpp
diff options
context:
space:
mode:
authorXTZGZoReX <none@none>2010-01-23 22:24:41 +0100
committerXTZGZoReX <none@none>2010-01-23 22:24:41 +0100
commit9f00ca3eb884399479009ae5d5a1224c047d0650 (patch)
tree1ba2681bb2ca1c7e4ad9b4334f1b725d222b44ed /src/game/Creature.cpp
parentfe07518bafe3f0a52630ce09ee5742453f2f6801 (diff)
* Remove CellLock class and all cell-level thread locking.
** It was wasting CPU power as cell-level locking is not needed. ** Our multithreading is on map-level, not cell-level. ** CellLock was just a 'proxy' between Cell and CellPair and in some cases carried redundant data. ** Some minor cleanup in Cell::Visit/Map::Visit. --HG-- branch : trunk
Diffstat (limited to 'src/game/Creature.cpp')
-rw-r--r--src/game/Creature.cpp14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp
index 29ed9983cd2..c486592e54b 100644
--- a/src/game/Creature.cpp
+++ b/src/game/Creature.cpp
@@ -698,8 +698,7 @@ void Creature::DoFleeToGetAssistance()
TypeContainerVisitor<Trinity::CreatureLastSearcher<Trinity::NearestAssistCreatureInCreatureRangeCheck>, GridTypeMapContainer > grid_creature_searcher(searcher);
- CellLock<GridReadGuard> cell_lock(cell, p);
- cell_lock->Visit(cell_lock, grid_creature_searcher, *GetMap(), *this, radius);
+ cell.Visit(p, grid_creature_searcher, *GetMap(), *this, radius);
SetNoSearchAssistance(true);
UpdateSpeed(MOVE_RUN, false);
@@ -1778,9 +1777,8 @@ Unit* Creature::SelectNearestTarget(float dist) const
TypeContainerVisitor<Trinity::UnitLastSearcher<Trinity::NearestHostileUnitInAttackDistanceCheck>, WorldTypeMapContainer > world_unit_searcher(searcher);
TypeContainerVisitor<Trinity::UnitLastSearcher<Trinity::NearestHostileUnitInAttackDistanceCheck>, GridTypeMapContainer > grid_unit_searcher(searcher);
- CellLock<GridReadGuard> cell_lock(cell, p);
- cell_lock->Visit(cell_lock, world_unit_searcher, *GetMap(), *this, ATTACK_DISTANCE);
- cell_lock->Visit(cell_lock, grid_unit_searcher, *GetMap(), *this, ATTACK_DISTANCE);
+ cell.Visit(p, world_unit_searcher, *GetMap(), *this, ATTACK_DISTANCE);
+ cell.Visit(p, grid_unit_searcher, *GetMap(), *this, ATTACK_DISTANCE);
}
return target;
@@ -1821,8 +1819,7 @@ void Creature::CallAssistance()
TypeContainerVisitor<Trinity::CreatureListSearcher<Trinity::AnyAssistCreatureInRangeCheck>, GridTypeMapContainer > grid_creature_searcher(searcher);
- CellLock<GridReadGuard> cell_lock(cell, p);
- cell_lock->Visit(cell_lock, grid_creature_searcher, *GetMap(), *this, radius);
+ cell.Visit(p, grid_creature_searcher, *GetMap(), *this, radius);
}
if (!assistList.empty())
@@ -1855,8 +1852,7 @@ void Creature::CallForHelp(float fRadius)
TypeContainerVisitor<Trinity::CreatureWorker<Trinity::CallOfHelpCreatureInRangeDo>, GridTypeMapContainer > grid_creature_searcher(worker);
- CellLock<GridReadGuard> cell_lock(cell, p);
- cell_lock->Visit(cell_lock, grid_creature_searcher, *GetMap(), *this, fRadius);
+ cell.Visit(p, grid_creature_searcher, *GetMap(), *this, fRadius);
}
bool Creature::CanAssistTo(const Unit* u, const Unit* enemy, bool checkfaction /*= true*/) const