[9245] Remove CellLock class and all cell-level thread locking.

* It was wasting CPU power as cell-level locking is not needed.
* Future multithreading will be on map-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.
This commit is contained in:
XTZGZoReX 2010-01-23 21:36:01 +01:00
parent 39b7636094
commit 0ff9250de2
19 changed files with 104 additions and 209 deletions

View file

@ -308,16 +308,14 @@ void GameObject::Update(uint32 /*p_time*/)
MaNGOS::AnyUnfriendlyUnitInObjectRangeCheck u_check(this, owner, radius);
MaNGOS::UnitSearcher<MaNGOS::AnyUnfriendlyUnitInObjectRangeCheck> checker(this,ok, u_check);
CellLock<GridReadGuard> cell_lock(cell, p);
TypeContainerVisitor<MaNGOS::UnitSearcher<MaNGOS::AnyUnfriendlyUnitInObjectRangeCheck>, GridTypeMapContainer > grid_object_checker(checker);
cell_lock->Visit(cell_lock, grid_object_checker, *GetMap(), *this, radius);
cell.Visit(p, grid_object_checker, *GetMap(), *this, radius);
// or unfriendly player/pet
if(!ok)
{
TypeContainerVisitor<MaNGOS::UnitSearcher<MaNGOS::AnyUnfriendlyUnitInObjectRangeCheck>, WorldTypeMapContainer > world_object_checker(checker);
cell_lock->Visit(cell_lock, world_object_checker, *GetMap(), *this, radius);
cell.Visit(p, world_object_checker, *GetMap(), *this, radius);
}
}
else // environmental trap
@ -329,10 +327,8 @@ void GameObject::Update(uint32 /*p_time*/)
MaNGOS::AnyPlayerInObjectRangeCheck p_check(this, radius);
MaNGOS::PlayerSearcher<MaNGOS::AnyPlayerInObjectRangeCheck> checker(this,p_ok, p_check);
CellLock<GridReadGuard> cell_lock(cell, p);
TypeContainerVisitor<MaNGOS::PlayerSearcher<MaNGOS::AnyPlayerInObjectRangeCheck>, WorldTypeMapContainer > world_object_checker(checker);
cell_lock->Visit(cell_lock, world_object_checker, *GetMap(), *this, radius);
cell.Visit(p, world_object_checker, *GetMap(), *this, radius);
ok = p_ok;
}
@ -798,8 +794,7 @@ void GameObject::TriggeringLinkedGameObject( uint32 trapEntry, Unit* target)
MaNGOS::GameObjectLastSearcher<MaNGOS::NearestGameObjectEntryInObjectRangeCheck> checker(this, trapGO,go_check);
TypeContainerVisitor<MaNGOS::GameObjectLastSearcher<MaNGOS::NearestGameObjectEntryInObjectRangeCheck>, GridTypeMapContainer > object_checker(checker);
CellLock<GridReadGuard> cell_lock(cell, p);
cell_lock->Visit(cell_lock, object_checker, *GetMap(), *target, range);
cell.Visit(p, object_checker, *GetMap(), *target, range);
}
// found correct GO
@ -818,10 +813,8 @@ GameObject* GameObject::LookupFishingHoleAround(float range)
MaNGOS::NearestGameObjectFishingHole u_check(*this, range);
MaNGOS::GameObjectSearcher<MaNGOS::NearestGameObjectFishingHole> checker(this, ok, u_check);
CellLock<GridReadGuard> cell_lock(cell, p);
TypeContainerVisitor<MaNGOS::GameObjectSearcher<MaNGOS::NearestGameObjectFishingHole>, GridTypeMapContainer > grid_object_checker(checker);
cell_lock->Visit(cell_lock, grid_object_checker, *GetMap(), *this, range);
cell.Visit(p, grid_object_checker, *GetMap(), *this, range);
return ok;
}