From 9f00ca3eb884399479009ae5d5a1224c047d0650 Mon Sep 17 00:00:00 2001 From: XTZGZoReX Date: Sat, 23 Jan 2010 22:24:41 +0100 Subject: * 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 --- src/game/Creature.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'src/game/Creature.cpp') 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, GridTypeMapContainer > grid_creature_searcher(searcher); - CellLock 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, WorldTypeMapContainer > world_unit_searcher(searcher); TypeContainerVisitor, GridTypeMapContainer > grid_unit_searcher(searcher); - CellLock 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, GridTypeMapContainer > grid_creature_searcher(searcher); - CellLock 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, GridTypeMapContainer > grid_creature_searcher(worker); - CellLock 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 -- cgit v1.2.3