mirror of
https://github.com/mangosfour/server.git
synced 2025-12-16 04:37:00 +00:00
[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:
parent
39b7636094
commit
0ff9250de2
19 changed files with 104 additions and 209 deletions
|
|
@ -457,13 +457,12 @@ WorldObject* Spell::FindCorpseUsing()
|
|||
MaNGOS::WorldObjectSearcher<T> searcher(m_caster, result, u_check);
|
||||
|
||||
TypeContainerVisitor<MaNGOS::WorldObjectSearcher<T>, GridTypeMapContainer > grid_searcher(searcher);
|
||||
CellLock<GridReadGuard> cell_lock(cell, p);
|
||||
cell_lock->Visit(cell_lock, grid_searcher, *m_caster->GetMap(), *m_caster, max_range);
|
||||
cell.Visit(p, grid_searcher, *m_caster->GetMap(), *m_caster, max_range);
|
||||
|
||||
if (!result)
|
||||
{
|
||||
TypeContainerVisitor<MaNGOS::WorldObjectSearcher<T>, WorldTypeMapContainer > world_searcher(searcher);
|
||||
cell_lock->Visit(cell_lock, world_searcher, *m_caster->GetMap(), *m_caster, max_range);
|
||||
cell.Visit(p, world_searcher, *m_caster->GetMap(), *m_caster, max_range);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
|
@ -1453,9 +1452,8 @@ void Spell::SetTargetMap(uint32 effIndex, uint32 targetMode, UnitList& targetUni
|
|||
TypeContainerVisitor<MaNGOS::UnitListSearcher<MaNGOS::AnyAoETargetUnitInObjectRangeCheck>, WorldTypeMapContainer > world_unit_searcher(searcher);
|
||||
TypeContainerVisitor<MaNGOS::UnitListSearcher<MaNGOS::AnyAoETargetUnitInObjectRangeCheck>, GridTypeMapContainer > grid_unit_searcher(searcher);
|
||||
|
||||
CellLock<GridReadGuard> cell_lock(cell, p);
|
||||
cell_lock->Visit(cell_lock, world_unit_searcher, *m_caster->GetMap(), *m_caster, max_range);
|
||||
cell_lock->Visit(cell_lock, grid_unit_searcher, *m_caster->GetMap(), *m_caster, max_range);
|
||||
cell.Visit(p, world_unit_searcher, *m_caster->GetMap(), *m_caster, max_range);
|
||||
cell.Visit(p, grid_unit_searcher, *m_caster->GetMap(), *m_caster, max_range);
|
||||
}
|
||||
|
||||
if(tempTargetUnitMap.empty())
|
||||
|
|
@ -1523,9 +1521,8 @@ void Spell::SetTargetMap(uint32 effIndex, uint32 targetMode, UnitList& targetUni
|
|||
TypeContainerVisitor<MaNGOS::UnitListSearcher<MaNGOS::AnyFriendlyUnitInObjectRangeCheck>, WorldTypeMapContainer > world_unit_searcher(searcher);
|
||||
TypeContainerVisitor<MaNGOS::UnitListSearcher<MaNGOS::AnyFriendlyUnitInObjectRangeCheck>, GridTypeMapContainer > grid_unit_searcher(searcher);
|
||||
|
||||
CellLock<GridReadGuard> cell_lock(cell, p);
|
||||
cell_lock->Visit(cell_lock, world_unit_searcher, *m_caster->GetMap(), *m_caster, max_range);
|
||||
cell_lock->Visit(cell_lock, grid_unit_searcher, *m_caster->GetMap(), *m_caster, max_range);
|
||||
cell.Visit(p, world_unit_searcher, *m_caster->GetMap(), *m_caster, max_range);
|
||||
cell.Visit(p, grid_unit_searcher, *m_caster->GetMap(), *m_caster, max_range);
|
||||
}
|
||||
|
||||
if(tempTargetUnitMap.empty())
|
||||
|
|
@ -1618,10 +1615,9 @@ void Spell::SetTargetMap(uint32 effIndex, uint32 targetMode, UnitList& targetUni
|
|||
MaNGOS::UnitListSearcher<MaNGOS::AnyAoETargetUnitInObjectRangeCheck> searcher(m_caster, tempTargetUnitMap, u_check);
|
||||
TypeContainerVisitor<MaNGOS::UnitListSearcher<MaNGOS::AnyAoETargetUnitInObjectRangeCheck>, WorldTypeMapContainer> world_unit_searcher(searcher);
|
||||
TypeContainerVisitor<MaNGOS::UnitListSearcher<MaNGOS::AnyAoETargetUnitInObjectRangeCheck>, GridTypeMapContainer> grid_unit_searcher(searcher);
|
||||
CellLock<GridReadGuard> cell_lock(cell, p);
|
||||
|
||||
cell_lock->Visit(cell_lock, world_unit_searcher, *m_caster->GetMap(), *pUnitTarget, max_range);
|
||||
cell_lock->Visit(cell_lock, grid_unit_searcher, *m_caster->GetMap(), *pUnitTarget, max_range);
|
||||
cell.Visit(p, world_unit_searcher, *m_caster->GetMap(), *pUnitTarget, max_range);
|
||||
cell.Visit(p, grid_unit_searcher, *m_caster->GetMap(), *pUnitTarget, max_range);
|
||||
}
|
||||
if (tempTargetUnitMap.empty())
|
||||
break;
|
||||
|
|
@ -4314,8 +4310,7 @@ SpellCastResult Spell::CheckCast(bool strict)
|
|||
MaNGOS::GameObjectLastSearcher<MaNGOS::NearestGameObjectEntryInObjectRangeCheck> checker(m_caster, p_GameObject, go_check);
|
||||
|
||||
TypeContainerVisitor<MaNGOS::GameObjectLastSearcher<MaNGOS::NearestGameObjectEntryInObjectRangeCheck>, GridTypeMapContainer > object_checker(checker);
|
||||
CellLock<GridReadGuard> cell_lock(cell, p);
|
||||
cell_lock->Visit(cell_lock, object_checker, *m_caster->GetMap(), *m_caster, range);
|
||||
cell.Visit(p, object_checker, *m_caster->GetMap(), *m_caster, range);
|
||||
|
||||
if (p_GameObject)
|
||||
{
|
||||
|
|
@ -4353,8 +4348,7 @@ SpellCastResult Spell::CheckCast(bool strict)
|
|||
|
||||
TypeContainerVisitor<MaNGOS::CreatureLastSearcher<MaNGOS::NearestCreatureEntryWithLiveStateInObjectRangeCheck>, GridTypeMapContainer > grid_creature_searcher(searcher);
|
||||
|
||||
CellLock<GridReadGuard> cell_lock(cell, p);
|
||||
cell_lock->Visit(cell_lock, grid_creature_searcher, *m_caster->GetMap(), *m_caster, range);
|
||||
cell.Visit(p, grid_creature_searcher, *m_caster->GetMap(), *m_caster, range);
|
||||
|
||||
if (p_Creature)
|
||||
{
|
||||
|
|
@ -5494,9 +5488,8 @@ SpellCastResult Spell::CheckItems()
|
|||
MaNGOS::GameObjectSearcher<MaNGOS::GameObjectFocusCheck> checker(m_caster, ok, go_check);
|
||||
|
||||
TypeContainerVisitor<MaNGOS::GameObjectSearcher<MaNGOS::GameObjectFocusCheck>, GridTypeMapContainer > object_checker(checker);
|
||||
CellLock<GridReadGuard> cell_lock(cell, p);
|
||||
Map& map = *m_caster->GetMap();
|
||||
cell_lock->Visit(cell_lock, object_checker, map, *m_caster, map.GetVisibilityDistance());
|
||||
cell.Visit(p, object_checker, map, *m_caster, map.GetVisibilityDistance());
|
||||
|
||||
if(!ok)
|
||||
return SPELL_FAILED_REQUIRES_SPELL_FOCUS;
|
||||
|
|
@ -6232,9 +6225,8 @@ void Spell::FillAreaTargets(UnitList &targetUnitMap, float x, float y, float rad
|
|||
MaNGOS::SpellNotifierCreatureAndPlayer notifier(*this, targetUnitMap, radius, pushType, spellTargets);
|
||||
TypeContainerVisitor<MaNGOS::SpellNotifierCreatureAndPlayer, WorldTypeMapContainer > world_notifier(notifier);
|
||||
TypeContainerVisitor<MaNGOS::SpellNotifierCreatureAndPlayer, GridTypeMapContainer > grid_notifier(notifier);
|
||||
CellLock<GridReadGuard> cell_lock(cell, p);
|
||||
cell_lock->Visit(cell_lock, world_notifier, *m_caster->GetMap(), *m_caster, radius);
|
||||
cell_lock->Visit(cell_lock, grid_notifier, *m_caster->GetMap(), *m_caster, radius);
|
||||
cell.Visit(p, world_notifier, *m_caster->GetMap(), *m_caster, radius);
|
||||
cell.Visit(p, grid_notifier, *m_caster->GetMap(), *m_caster, radius);
|
||||
}
|
||||
|
||||
void Spell::FillRaidOrPartyTargets(UnitList &targetUnitMap, Unit* member, Unit* center, float radius, bool raid, bool withPets, bool withcaster)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue