aboutsummaryrefslogtreecommitdiff
path: root/src
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
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')
-rw-r--r--src/game/AchievementMgr.cpp3
-rw-r--r--src/game/Cell.h27
-rw-r--r--src/game/CellImpl.h55
-rw-r--r--src/game/Chat.cpp3
-rw-r--r--src/game/ChatHandler.cpp3
-rw-r--r--src/game/Creature.cpp14
-rw-r--r--src/game/CreatureEventAI.cpp9
-rw-r--r--src/game/GameObject.cpp7
-rw-r--r--src/game/GridNotifiers.h8
-rw-r--r--src/game/GridNotifiersImpl.h4
-rw-r--r--src/game/Level3.cpp3
-rw-r--r--src/game/Map.cpp63
-rw-r--r--src/game/Map.h51
-rw-r--r--src/game/Object.cpp15
-rw-r--r--src/game/ObjectAccessor.cpp3
-rw-r--r--src/game/ScriptedCreature.cpp3
-rw-r--r--src/game/Spell.cpp8
-rw-r--r--src/game/SpellAuraEffects.cpp6
-rw-r--r--src/scripts/eastern_kingdoms/sunwell_plateau/boss_felmyst.cpp3
-rw-r--r--src/scripts/eastern_kingdoms/sunwell_plateau/boss_kiljaeden.cpp5
-rw-r--r--src/scripts/eastern_kingdoms/zulaman/boss_akilzon.cpp5
-rw-r--r--src/scripts/eastern_kingdoms/zulaman/boss_janalai.cpp9
-rw-r--r--src/scripts/eastern_kingdoms/zulaman/boss_nalorakk.cpp3
-rw-r--r--src/scripts/kalimdor/caverns_of_time/hyjal/hyjalAI.cpp12
24 files changed, 110 insertions, 212 deletions
diff --git a/src/game/AchievementMgr.cpp b/src/game/AchievementMgr.cpp
index 66c5b2ecd30..cae836c4b6f 100644
--- a/src/game/AchievementMgr.cpp
+++ b/src/game/AchievementMgr.cpp
@@ -626,8 +626,7 @@ void AchievementMgr::SendAchievementEarned(AchievementEntry const* achievement)
Trinity::LocalizedPacketDo<Trinity::AchievementChatBuilder> say_do(say_builder);
Trinity::PlayerDistWorker<Trinity::LocalizedPacketDo<Trinity::AchievementChatBuilder> > say_worker(GetPlayer(),sWorld.getConfig(CONFIG_LISTEN_RANGE_SAY),say_do);
TypeContainerVisitor<Trinity::PlayerDistWorker<Trinity::LocalizedPacketDo<Trinity::AchievementChatBuilder> >, WorldTypeMapContainer > message(say_worker);
- CellLock<GridReadGuard> cell_lock(cell, p);
- cell_lock->Visit(cell_lock, message, *GetPlayer()->GetMap(), *GetPlayer(), sWorld.getConfig(CONFIG_LISTEN_RANGE_SAY));
+ cell.Visit(p, message, *GetPlayer()->GetMap(), *GetPlayer(), sWorld.getConfig(CONFIG_LISTEN_RANGE_SAY));
}
WorldPacket data(SMSG_ACHIEVEMENT_EARNED, 8+4+8);
diff --git a/src/game/Cell.h b/src/game/Cell.h
index fa321e728e7..a558b754b83 100644
--- a/src/game/Cell.h
+++ b/src/game/Cell.h
@@ -45,8 +45,6 @@ enum District
ALL_DISTRICT = (UPPER_DISTRICT | LOWER_DISTRICT | LEFT_DISTRICT | RIGHT_DISTRICT | CENTER_DISTRICT)
};
-template<class T> struct CellLock;
-
struct TRINITY_DLL_DECL CellArea
{
CellArea() : right_offset(0), left_offset(0), upper_offset(0), lower_offset(0) {}
@@ -164,33 +162,16 @@ struct TRINITY_DLL_DECL Cell
uint32 All;
} data;
- template<class LOCK_TYPE, class T, class CONTAINER> void Visit(const CellLock<LOCK_TYPE> &, TypeContainerVisitor<T, CONTAINER> &visitor, Map &) const;
- template<class LOCK_TYPE, class T, class CONTAINER> void Visit(const CellLock<LOCK_TYPE> &, TypeContainerVisitor<T, CONTAINER> &visitor, Map &m, const WorldObject &obj, float radius) const;
- template<class LOCK_TYPE, class T, class CONTAINER> void Visit(const CellLock<LOCK_TYPE> &, TypeContainerVisitor<T, CONTAINER> &visitor, Map &, float radius, float x_off, float y_off) const;
+ template<class T, class CONTAINER> void Visit(const CellPair&, TypeContainerVisitor<T, CONTAINER> &visitor, Map &) const;
+ template<class T, class CONTAINER> void Visit(const CellPair&, TypeContainerVisitor<T, CONTAINER> &visitor, Map &, const WorldObject&, float) const;
+ template<class T, class CONTAINER> void Visit(const CellPair&, TypeContainerVisitor<T, CONTAINER> &visitor, Map &, float, float, float) const;
static CellArea CalculateCellArea(const WorldObject &obj, float radius);
static CellArea CalculateCellArea(float x, float y, float radius);
private:
- template<class LOCK_TYPE, class T, class CONTAINER> void VisitCircle(const CellLock<LOCK_TYPE> &, TypeContainerVisitor<T, CONTAINER> &, Map &, const CellPair& , const CellPair& ) const;
+ template<class T, class CONTAINER> void VisitCircle(TypeContainerVisitor<T, CONTAINER> &, Map &, const CellPair&, const CellPair&) const;
};
-template<class T>
-struct TRINITY_DLL_DECL CellLock
-{
- const Cell& i_cell;
- const CellPair &i_cellPair;
- CellLock(const Cell &c, const CellPair &p) : i_cell(c), i_cellPair(p) {}
- CellLock(const CellLock<T> &cell) : i_cell(cell.i_cell), i_cellPair(cell.i_cellPair) {}
- const Cell* operator->(void) const { return &i_cell; }
- const Cell* operator->(void) { return &i_cell; }
- operator const Cell &(void) const { return i_cell; }
- CellLock<T>& operator=(const CellLock<T> &cell)
- {
- this->~CellLock();
- new (this) CellLock<T>(cell);
- return *this;
- }
-};
#endif
diff --git a/src/game/CellImpl.h b/src/game/CellImpl.h
index c34bdab7c8a..5ab4859541a 100644
--- a/src/game/CellImpl.h
+++ b/src/game/CellImpl.h
@@ -37,18 +37,17 @@ inline Cell::Cell(CellPair const& p)
data.Part.reserved = 0;
}
-template<class LOCK_TYPE,class T, class CONTAINER>
+template<class T, class CONTAINER>
inline void
-Cell::Visit(const CellLock<LOCK_TYPE> &l, TypeContainerVisitor<T, CONTAINER> &visitor, Map &m) const
+Cell::Visit(const CellPair& standing_cell, TypeContainerVisitor<T, CONTAINER> &visitor, Map &m) const
{
- const CellPair &standing_cell = l.i_cellPair;
if (standing_cell.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || standing_cell.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP)
return;
uint16 district = (District)this->data.Part.reserved;
if(district == CENTER_DISTRICT)
{
- m.Visit(l, visitor);
+ m.Visit(*this, visitor);
return;
}
@@ -125,9 +124,8 @@ Cell::Visit(const CellLock<LOCK_TYPE> &l, TypeContainerVisitor<T, CONTAINER> &vi
{
CellPair cell_pair(x,y);
Cell r_zone(cell_pair);
- r_zone.data.Part.nocreate = l->data.Part.nocreate;
- CellLock<LOCK_TYPE> lock(r_zone, cell_pair);
- m.Visit(lock, visitor);
+ r_zone.data.Part.nocreate = this->data.Part.nocreate;
+ m.Visit(r_zone, visitor);
}
}
}
@@ -171,11 +169,10 @@ inline CellArea Cell::CalculateCellArea(float x, float y, float radius)
return CellArea(right, left, upper, lower);
}
-template<class LOCK_TYPE, class T, class CONTAINER>
+template<class T, class CONTAINER>
inline void
-Cell::Visit(const CellLock<LOCK_TYPE> &l, TypeContainerVisitor<T, CONTAINER> &visitor, Map &m, float radius, float x_off, float y_off) const
+Cell::Visit(const CellPair& standing_cell, TypeContainerVisitor<T, CONTAINER> &visitor, Map &m, float radius, float x_off, float y_off) const
{
- const CellPair &standing_cell = l.i_cellPair;
if (standing_cell.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || standing_cell.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP)
return;
@@ -184,7 +181,7 @@ Cell::Visit(const CellLock<LOCK_TYPE> &l, TypeContainerVisitor<T, CONTAINER> &vi
//maybe it is better to just return when radius <= 0.0f?
if (radius <= 0.0f)
{
- m.Visit(l, visitor);
+ m.Visit(*this, visitor);
return;
}
//lets limit the upper value for search radius
@@ -196,7 +193,7 @@ Cell::Visit(const CellLock<LOCK_TYPE> &l, TypeContainerVisitor<T, CONTAINER> &vi
//if radius fits inside standing cell
if (!area)
{
- m.Visit(l, visitor);
+ m.Visit(*this, visitor);
return;
}
@@ -210,13 +207,13 @@ Cell::Visit(const CellLock<LOCK_TYPE> &l, TypeContainerVisitor<T, CONTAINER> &vi
//there are nothing to optimize because SIZE_OF_GRID_CELL is too big...
if (((end_cell.x_coord - begin_cell.x_coord) > 4) && ((end_cell.y_coord - begin_cell.y_coord) > 4))
{
- VisitCircle(l, visitor, m, begin_cell, end_cell);
+ VisitCircle(visitor, m, begin_cell, end_cell);
return;
}
//ALWAYS visit standing cell first!!! Since we deal with small radiuses
//it is very essential to call visitor for standing cell firstly...
- m.Visit(l, visitor);
+ m.Visit(*this, visitor);
// loop the cell range
for (uint32 x = begin_cell.x_coord; x <= end_cell.x_coord; ++x)
@@ -228,26 +225,25 @@ Cell::Visit(const CellLock<LOCK_TYPE> &l, TypeContainerVisitor<T, CONTAINER> &vi
if(cell_pair != standing_cell)
{
Cell r_zone(cell_pair);
- r_zone.data.Part.nocreate = l->data.Part.nocreate;
- CellLock<LOCK_TYPE> lock(r_zone, cell_pair);
- m.Visit(lock, visitor);
+ r_zone.data.Part.nocreate = this->data.Part.nocreate;
+ m.Visit(r_zone, visitor);
}
}
}
}
-template<class LOCK_TYPE, class T, class CONTAINER>
+template<class T, class CONTAINER>
inline void
-Cell::Visit(const CellLock<LOCK_TYPE> &l, TypeContainerVisitor<T, CONTAINER> &visitor, Map &m, const WorldObject &obj, float radius) const
+Cell::Visit(const CellPair& l, TypeContainerVisitor<T, CONTAINER> &visitor, Map &m, const WorldObject &obj, float radius) const
{
//we should increase search radius by object's radius, otherwise
//we could have problems with huge creatures, which won't attack nearest players etc
- Cell::Visit(l, visitor, m, radius + obj.GetObjectSize(), obj.GetPositionX(), obj.GetPositionY());
+ Visit(l, visitor, m, radius + obj.GetObjectSize(), obj.GetPositionX(), obj.GetPositionY());
}
-template<class LOCK_TYPE, class T, class CONTAINER>
+template<class T, class CONTAINER>
inline void
-Cell::VisitCircle(const CellLock<LOCK_TYPE> &l, TypeContainerVisitor<T, CONTAINER> &visitor, Map &m, const CellPair& begin_cell, const CellPair& end_cell) const
+Cell::VisitCircle(TypeContainerVisitor<T, CONTAINER> &visitor, Map &m, const CellPair& begin_cell, const CellPair& end_cell) const
{
//here is an algorithm for 'filling' circum-squared octagon
uint32 x_shift = (uint32)ceilf((end_cell.x_coord - begin_cell.x_coord) * 0.3f - 0.5f);
@@ -262,9 +258,8 @@ Cell::VisitCircle(const CellLock<LOCK_TYPE> &l, TypeContainerVisitor<T, CONTAINE
{
CellPair cell_pair(x,y);
Cell r_zone(cell_pair);
- r_zone.data.Part.nocreate = l->data.Part.nocreate;
- CellLock<LOCK_TYPE> lock(r_zone, cell_pair);
- m.Visit(lock, visitor);
+ r_zone.data.Part.nocreate = this->data.Part.nocreate;
+ m.Visit(r_zone, visitor);
}
}
@@ -287,16 +282,14 @@ Cell::VisitCircle(const CellLock<LOCK_TYPE> &l, TypeContainerVisitor<T, CONTAINE
//e.g. filling 2 trapezoids after filling central cell strip...
CellPair cell_pair_left(x_start - step, y);
Cell r_zone_left(cell_pair_left);
- r_zone_left.data.Part.nocreate = l->data.Part.nocreate;
- CellLock<LOCK_TYPE> lock_left(r_zone_left, cell_pair_left);
- m.Visit(lock_left, visitor);
+ r_zone_left.data.Part.nocreate = this->data.Part.nocreate;
+ m.Visit(r_zone_left, visitor);
//right trapezoid cell visit
CellPair cell_pair_right(x_end + step, y);
Cell r_zone_right(cell_pair_right);
- r_zone_right.data.Part.nocreate = l->data.Part.nocreate;
- CellLock<LOCK_TYPE> lock_right(r_zone_right, cell_pair_right);
- m.Visit(lock_right, visitor);
+ r_zone_right.data.Part.nocreate = this->data.Part.nocreate;
+ m.Visit(r_zone_right, visitor);
}
}
}
diff --git a/src/game/Chat.cpp b/src/game/Chat.cpp
index 3cc868a2b3e..f5e85b467b3 100644
--- a/src/game/Chat.cpp
+++ b/src/game/Chat.cpp
@@ -2086,8 +2086,7 @@ GameObject* ChatHandler::GetObjectGlobalyWithGuidOrNearWithDbGuid(uint32 lowguid
Trinity::GameObjectSearcher<Trinity::GameObjectWithDbGUIDCheck> checker(pl,obj,go_check);
TypeContainerVisitor<Trinity::GameObjectSearcher<Trinity::GameObjectWithDbGUIDCheck>, GridTypeMapContainer > object_checker(checker);
- CellLock<GridReadGuard> cell_lock(cell, p);
- cell_lock->Visit(cell_lock, object_checker, *pl->GetMap());
+ cell.Visit(p, object_checker, *pl->GetMap());
}
return obj;
diff --git a/src/game/ChatHandler.cpp b/src/game/ChatHandler.cpp
index 42c4b0b019f..4d2636afa02 100644
--- a/src/game/ChatHandler.cpp
+++ b/src/game/ChatHandler.cpp
@@ -673,8 +673,7 @@ void WorldSession::HandleTextEmoteOpcode( WorldPacket & recv_data )
Trinity::LocalizedPacketDo<Trinity::EmoteChatBuilder > emote_do(emote_builder);
Trinity::PlayerDistWorker<Trinity::LocalizedPacketDo<Trinity::EmoteChatBuilder > > emote_worker(GetPlayer(),sWorld.getConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE),emote_do);
TypeContainerVisitor<Trinity::PlayerDistWorker<Trinity::LocalizedPacketDo<Trinity::EmoteChatBuilder > >, WorldTypeMapContainer > message(emote_worker);
- CellLock<GridReadGuard> cell_lock(cell, p);
- cell_lock->Visit(cell_lock, message, *GetPlayer()->GetMap(), *GetPlayer(), sWorld.getConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE));
+ cell.Visit(p, message, *GetPlayer()->GetMap(), *GetPlayer(), sWorld.getConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE));
GetPlayer()->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_DO_EMOTE, text_emote, 0, unit);
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
diff --git a/src/game/CreatureEventAI.cpp b/src/game/CreatureEventAI.cpp
index a18b9441705..debcdfb8056 100644
--- a/src/game/CreatureEventAI.cpp
+++ b/src/game/CreatureEventAI.cpp
@@ -1196,8 +1196,7 @@ Unit* CreatureEventAI::DoSelectLowestHpFriendly(float range, uint32 MinHPDiff)
*/
TypeContainerVisitor<Trinity::UnitLastSearcher<Trinity::MostHPMissingInRange>, GridTypeMapContainer > grid_unit_searcher(searcher);
- CellLock<GridReadGuard> cell_lock(cell, p);
- cell_lock->Visit(cell_lock, grid_unit_searcher, *m_creature->GetMap(), *m_creature, range);
+ cell.Visit(p, grid_unit_searcher, *m_creature->GetMap(), *m_creature, range);
return pUnit;
}
@@ -1213,8 +1212,7 @@ void CreatureEventAI::DoFindFriendlyCC(std::list<Creature*>& _list, float range)
TypeContainerVisitor<Trinity::CreatureListSearcher<Trinity::FriendlyCCedInRange>, GridTypeMapContainer > grid_creature_searcher(searcher);
- CellLock<GridReadGuard> cell_lock(cell, p);
- cell_lock->Visit(cell_lock, grid_creature_searcher, *m_creature->GetMap());
+ cell.Visit(p, grid_creature_searcher, *m_creature->GetMap());
}
void CreatureEventAI::DoFindFriendlyMissingBuff(std::list<Creature*>& _list, float range, uint32 spellid)
@@ -1229,8 +1227,7 @@ void CreatureEventAI::DoFindFriendlyMissingBuff(std::list<Creature*>& _list, flo
TypeContainerVisitor<Trinity::CreatureListSearcher<Trinity::FriendlyMissingBuffInRange>, GridTypeMapContainer > grid_creature_searcher(searcher);
- CellLock<GridReadGuard> cell_lock(cell, p);
- cell_lock->Visit(cell_lock, grid_creature_searcher, *m_creature->GetMap());
+ cell.Visit(p, grid_creature_searcher, *m_creature->GetMap());
}
//*********************************
diff --git a/src/game/GameObject.cpp b/src/game/GameObject.cpp
index 5d6f730a045..2b69dac6134 100644
--- a/src/game/GameObject.cpp
+++ b/src/game/GameObject.cpp
@@ -883,8 +883,7 @@ void GameObject::TriggeringLinkedGameObject(uint32 trapEntry, Unit* target)
Trinity::GameObjectLastSearcher<Trinity::NearestGameObjectEntryInObjectRangeCheck> checker(this, trapGO,go_check);
TypeContainerVisitor<Trinity::GameObjectLastSearcher<Trinity::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
@@ -903,10 +902,8 @@ GameObject* GameObject::LookupFishingHoleAround(float range)
Trinity::NearestGameObjectFishingHole u_check(*this, range);
Trinity::GameObjectSearcher<Trinity::NearestGameObjectFishingHole> checker(this, ok, u_check);
- CellLock<GridReadGuard> cell_lock(cell, p);
-
TypeContainerVisitor<Trinity::GameObjectSearcher<Trinity::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;
}
diff --git a/src/game/GridNotifiers.h b/src/game/GridNotifiers.h
index 0e179825da2..6654bb0545a 100644
--- a/src/game/GridNotifiers.h
+++ b/src/game/GridNotifiers.h
@@ -101,12 +101,12 @@ namespace Trinity
struct TRINITY_DLL_DECL DelayedUnitRelocation
{
- typedef GridReadGuard ReadGuard;
Map &i_map;
- CellLock<ReadGuard> &i_lock;
+ const Cell& i_cell;
+ const CellPair& i_cellPair;
const float i_radius;
- DelayedUnitRelocation(CellLock<ReadGuard> &lock, Map &map, float radius) :
- i_lock(lock), i_map(map), i_radius(radius) {}
+ DelayedUnitRelocation(const Cell& cell, const CellPair& cellp, Map &map, float radius) :
+ i_cell(cell), i_cellPair(cellp), i_map(map), i_radius(radius) {}
template<class T> void Visit(GridRefManager<T> &) {}
void Visit(CreatureMapType &m) { Notify<Creature,CreatureRelocationNotifier >(m); }
void Visit(PlayerMapType &m) { Notify<Player,PlayerRelocationNotifier >(m); }
diff --git a/src/game/GridNotifiersImpl.h b/src/game/GridNotifiersImpl.h
index 1409e770270..94f4de0e937 100644
--- a/src/game/GridNotifiersImpl.h
+++ b/src/game/GridNotifiersImpl.h
@@ -99,8 +99,8 @@ Trinity::DelayedUnitRelocation::Notify(GridRefManager<T> &m)
TypeContainerVisitor<VISITOR, WorldTypeMapContainer > c2world_relocation(relocate);
TypeContainerVisitor<VISITOR, GridTypeMapContainer > c2grid_relocation(relocate);
- i_lock->Visit(i_lock, c2world_relocation, i_map, *unit, i_radius);
- i_lock->Visit(i_lock, c2grid_relocation, i_map, *unit, i_radius);
+ i_cell.Visit(i_cellPair, c2world_relocation, i_map, *unit, i_radius);
+ i_cell.Visit(i_cellPair, c2grid_relocation, i_map, *unit, i_radius);
unit->SetNotified(NOTIFY_AI_RELOCATION);
}
diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp
index 2755cb9c9b5..3f71bbdfc16 100644
--- a/src/game/Level3.cpp
+++ b/src/game/Level3.cpp
@@ -6192,8 +6192,7 @@ bool ChatHandler::HandleRespawnCommand(const char* /*args*/)
Trinity::WorldObjectWorker<Trinity::RespawnDo> worker(pl,u_do);
TypeContainerVisitor<Trinity::WorldObjectWorker<Trinity::RespawnDo>, GridTypeMapContainer > obj_worker(worker);
- CellLock<GridReadGuard> cell_lock(cell, p);
- cell_lock->Visit(cell_lock, obj_worker, *pl->GetMap());
+ cell.Visit(p, obj_worker, *pl->GetMap());
return true;
}
diff --git a/src/game/Map.cpp b/src/game/Map.cpp
index 0a6498e5c58..db09156d8b7 100644
--- a/src/game/Map.cpp
+++ b/src/game/Map.cpp
@@ -665,9 +665,8 @@ void Map::Update(const uint32 &t_diff)
Cell cell(pair);
cell.data.Part.reserved = CENTER_DISTRICT;
//cell.SetNoCreate();
- CellLock<NullGuard> cell_lock(cell, pair);
- cell_lock->Visit(cell_lock, grid_object_update, *this);
- cell_lock->Visit(cell_lock, world_object_update, *this);
+ cell.Visit(pair, grid_object_update, *this);
+ cell.Visit(pair, world_object_update, *this);
}
}
}
@@ -714,9 +713,8 @@ void Map::Update(const uint32 &t_diff)
Cell cell(pair);
cell.data.Part.reserved = CENTER_DISTRICT;
//cell.SetNoCreate();
- CellLock<NullGuard> cell_lock(cell, pair);
- cell_lock->Visit(cell_lock, grid_object_update, *this);
- cell_lock->Visit(cell_lock, world_object_update, *this);
+ cell.Visit(pair, grid_object_update, *this);
+ cell.Visit(pair, world_object_update, *this);
}
}
}
@@ -785,8 +783,7 @@ void Map::ProcesssPlayersVisibility()
cell.data.Part.reserved = ALL_DISTRICT;
//cell.SetNoCreate();
TypeContainerVisitor<Trinity::Player2PlayerNotifier, WorldTypeMapContainer > world_notifier(notifier);
- CellLock<ReadGuard> cell_lock(cell, cellpair);
- cell_lock->Visit(cell_lock, world_notifier, *this, *viewPoint, GetVisibilityDistance());
+ cell.Visit(cellpair, world_notifier, *this, *viewPoint, GetVisibilityDistance());
// send data
notifier.SendToSelf();
@@ -821,9 +818,8 @@ void Map::ProcessObjectsVisibility()
TypeContainerVisitor<Trinity::VisibleNotifier, WorldTypeMapContainer > world_notifier(notifier);
TypeContainerVisitor<Trinity::VisibleNotifier, GridTypeMapContainer > grid_notifier(notifier);
- CellLock<ReadGuard> cell_lock(cell, cellpair);
- cell_lock->Visit(cell_lock, world_notifier, *this, *viewPoint, GetVisibilityDistance());
- cell_lock->Visit(cell_lock, grid_notifier, *this, *viewPoint, GetVisibilityDistance());
+ cell.Visit(cellpair, world_notifier, *this, *viewPoint, GetVisibilityDistance());
+ cell.Visit(cellpair, grid_notifier, *this, *viewPoint, GetVisibilityDistance());
// send data
notifier.SendToSelf();
@@ -858,12 +854,11 @@ void Map::ProcessRelocationNotifies()
cell.data.Part.reserved = CENTER_DISTRICT;
cell.SetNoCreate();
- CellLock<ReadGuard> cell_lock(cell, pair);
- Trinity::DelayedUnitRelocation cell_relocation(cell_lock, *this, GetVisibilityDistance());
+ Trinity::DelayedUnitRelocation cell_relocation(cell, pair, *this, GetVisibilityDistance());
TypeContainerVisitor<Trinity::DelayedUnitRelocation, GridTypeMapContainer > grid_object_relocation(cell_relocation);
TypeContainerVisitor<Trinity::DelayedUnitRelocation, WorldTypeMapContainer > world_object_relocation(cell_relocation);
- cell_lock->Visit(cell_lock, grid_object_relocation, *this);
- cell_lock->Visit(cell_lock, world_object_relocation, *this);
+ cell.Visit(pair, grid_object_relocation, *this);
+ cell.Visit(pair, world_object_relocation, *this);
}
}
}
@@ -906,9 +901,8 @@ void Map::ResetNotifies(uint16 notify_mask)
Cell cell(pair);
cell.data.Part.reserved = CENTER_DISTRICT;
cell.SetNoCreate();
- CellLock<NullGuard> cell_lock(cell, pair);
- cell_lock->Visit(cell_lock, grid_notifier, *this);
- cell_lock->Visit(cell_lock, world_notifier, *this);
+ cell.Visit(pair, grid_notifier, *this);
+ cell.Visit(pair, world_notifier, *this);
}
}
}
@@ -2181,8 +2175,7 @@ void Map::UpdateObjectVisibility( WorldObject* obj, Cell cell, CellPair cellpair
cell.SetNoCreate();
Trinity::VisibleChangesNotifier notifier(*obj);
TypeContainerVisitor<Trinity::VisibleChangesNotifier, WorldTypeMapContainer > player_notifier(notifier);
- CellLock<GridReadGuard> cell_lock(cell, cellpair);
- cell_lock->Visit(cell_lock, player_notifier, *this, *obj, GetVisibilityDistance());
+ cell.Visit(cellpair, player_notifier, *this, *obj, GetVisibilityDistance());
}
@@ -2193,8 +2186,7 @@ void Map::UpdatePlayerVisibility( Player* player, Cell cell, CellPair cellpair )
Trinity::Player2PlayerNotifier pl_notifier(*player);
TypeContainerVisitor<Trinity::Player2PlayerNotifier, WorldTypeMapContainer > player_notifier(pl_notifier);
- CellLock<ReadGuard> cell_lock(cell, cellpair);
- cell_lock->Visit(cell_lock, player_notifier, *this, *player, GetVisibilityDistance());
+ cell.Visit(cellpair, player_notifier, *this, *player, GetVisibilityDistance());
pl_notifier.SendToSelf();
}
@@ -2206,9 +2198,8 @@ void Map::UpdateObjectsVisibilityFor( Player* player, Cell cell, CellPair cellpa
cell.SetNoCreate();
TypeContainerVisitor<Trinity::VisibleNotifier, WorldTypeMapContainer > world_notifier(notifier);
TypeContainerVisitor<Trinity::VisibleNotifier, GridTypeMapContainer > grid_notifier(notifier);
- CellLock<GridReadGuard> cell_lock(cell, cellpair);
- cell_lock->Visit(cell_lock, world_notifier, *this, *player, GetVisibilityDistance());
- cell_lock->Visit(cell_lock, grid_notifier, *this, *player, GetVisibilityDistance());
+ cell.Visit(cellpair, world_notifier, *this, *player, GetVisibilityDistance());
+ cell.Visit(cellpair, grid_notifier, *this, *player, GetVisibilityDistance());
// send data
notifier.SendToSelf();
@@ -2216,20 +2207,18 @@ void Map::UpdateObjectsVisibilityFor( Player* player, Cell cell, CellPair cellpa
/*
void Map::PlayerRelocationNotify( Player* player, Cell cell, CellPair cellpair )
{
- CellLock<ReadGuard> cell_lock(cell, cellpair);
Trinity::PlayerRelocationNotifier relocationNotifier(*player);
cell.data.Part.reserved = ALL_DISTRICT;
TypeContainerVisitor<Trinity::PlayerRelocationNotifier, GridTypeMapContainer > p2grid_relocation(relocationNotifier);
TypeContainerVisitor<Trinity::PlayerRelocationNotifier, WorldTypeMapContainer > p2world_relocation(relocationNotifier);
- cell_lock->Visit(cell_lock, p2grid_relocation, *this, *player, MAX_CREATURE_ATTACK_RADIUS);
- cell_lock->Visit(cell_lock, p2world_relocation, *this, *player, MAX_CREATURE_ATTACK_RADIUS);
+ cell.Visit(cellpair, p2grid_relocation, *this, *player, MAX_CREATURE_ATTACK_RADIUS);
+ cell.Visit(cellpair, p2world_relocation, *this, *player, MAX_CREATURE_ATTACK_RADIUS);
}
void Map::CreatureRelocationNotify(Creature *creature, Cell cell, CellPair cellpair)
{
- CellLock<ReadGuard> cell_lock(cell, cellpair);
Trinity::CreatureRelocationNotifier relocationNotifier(*creature);
cell.data.Part.reserved = ALL_DISTRICT;
cell.SetNoCreate(); // not trigger load unloaded grids at notifier call
@@ -2237,8 +2226,8 @@ void Map::CreatureRelocationNotify(Creature *creature, Cell cell, CellPair cellp
TypeContainerVisitor<Trinity::CreatureRelocationNotifier, WorldTypeMapContainer > c2world_relocation(relocationNotifier);
TypeContainerVisitor<Trinity::CreatureRelocationNotifier, GridTypeMapContainer > c2grid_relocation(relocationNotifier);
- cell_lock->Visit(cell_lock, c2world_relocation, *this, *creature, MAX_CREATURE_ATTACK_RADIUS);
- cell_lock->Visit(cell_lock, c2grid_relocation, *this, *creature, MAX_CREATURE_ATTACK_RADIUS);
+ cell.Visit(cellpair, c2world_relocation, *this, *creature, MAX_CREATURE_ATTACK_RADIUS);
+ cell.Visit(cellpair, c2grid_relocation, *this, *creature, MAX_CREATURE_ATTACK_RADIUS);
}
*/
@@ -3390,8 +3379,7 @@ void Map::ScriptsProcess()
Trinity::GameObjectSearcher<Trinity::GameObjectWithDbGUIDCheck> checker(summoner, go,go_check);
TypeContainerVisitor<Trinity::GameObjectSearcher<Trinity::GameObjectWithDbGUIDCheck>, GridTypeMapContainer > object_checker(checker);
- CellLock<GridReadGuard> cell_lock(cell, p);
- cell_lock->Visit(cell_lock, object_checker, *summoner->GetMap());
+ cell.Visit(p, object_checker, *summoner->GetMap());
if ( !go )
{
@@ -3450,8 +3438,7 @@ void Map::ScriptsProcess()
Trinity::GameObjectSearcher<Trinity::GameObjectWithDbGUIDCheck> checker(caster,door,go_check);
TypeContainerVisitor<Trinity::GameObjectSearcher<Trinity::GameObjectWithDbGUIDCheck>, GridTypeMapContainer > object_checker(checker);
- CellLock<GridReadGuard> cell_lock(cell, p);
- cell_lock->Visit(cell_lock, object_checker, *caster->GetMap());
+ cell.Visit(p, object_checker, *caster->GetMap());
if (!door)
{
@@ -3506,8 +3493,7 @@ void Map::ScriptsProcess()
Trinity::GameObjectSearcher<Trinity::GameObjectWithDbGUIDCheck> checker(caster,door,go_check);
TypeContainerVisitor<Trinity::GameObjectSearcher<Trinity::GameObjectWithDbGUIDCheck>, GridTypeMapContainer > object_checker(checker);
- CellLock<GridReadGuard> cell_lock(cell, p);
- cell_lock->Visit(cell_lock, object_checker, *caster->GetMap());
+ cell.Visit(p, object_checker, *caster->GetMap());
if ( !door )
{
@@ -3726,8 +3712,7 @@ void Map::ScriptsProcess()
Trinity::CreatureSearcher<Trinity::CreatureWithDbGUIDCheck> checker(((Unit*)source), target, target_check);
TypeContainerVisitor<Trinity::CreatureSearcher <Trinity::CreatureWithDbGUIDCheck>, GridTypeMapContainer > unit_checker(checker);
- CellLock<GridReadGuard> cell_lock(cell, p);
- cell_lock->Visit(cell_lock, unit_checker, *(((Unit*)source)->GetMap()));
+ cell.Visit(p, unit_checker, *(((Unit*)source)->GetMap()));
}
else //check hashmap holders
{
diff --git a/src/game/Map.h b/src/game/Map.h
index 1dc19cf0aa3..df3a0fbaef1 100644
--- a/src/game/Map.h
+++ b/src/game/Map.h
@@ -53,26 +53,6 @@ struct ScriptAction;
struct Position;
class BattleGround;
-typedef ACE_RW_Thread_Mutex GridRWLock;
-
-template<class MUTEX, class LOCK_TYPE>
-struct RGuard
-{
- RGuard(MUTEX &l) : i_lock(l.getReadLock()) {}
- Trinity::GeneralLock<LOCK_TYPE> i_lock;
-};
-
-template<class MUTEX, class LOCK_TYPE>
-struct WGuard
-{
- WGuard(MUTEX &l) : i_lock(l.getWriteLock()) {}
- Trinity::GeneralLock<LOCK_TYPE> i_lock;
-};
-
-typedef RGuard<GridRWLock, ACE_Thread_Mutex> GridReadGuard;
-typedef WGuard<GridRWLock, ACE_Thread_Mutex> GridWriteGuard;
-typedef Trinity::SingleThreaded<GridRWLock>::Lock NullGuard;
-
//******************************************
// Map file format defines
//******************************************
@@ -294,7 +274,7 @@ class TRINITY_DLL_SPEC Map : public GridRefManager<NGridType>, public Trinity::O
void PlayerRelocation(Player *, float x, float y, float z, float orientation);
void CreatureRelocation(Creature *creature, float x, float y, float z, float ang);
- template<class LOCK_TYPE, class T, class CONTAINER> void Visit(const CellLock<LOCK_TYPE> &cell, TypeContainerVisitor<T, CONTAINER> &visitor);
+ template<class T, class CONTAINER> void Visit(const Cell& cell, TypeContainerVisitor<T, CONTAINER> &visitor);
bool IsRemovalGrid(float x, float y) const
{
@@ -531,9 +511,6 @@ class TRINITY_DLL_SPEC Map : public GridRefManager<NGridType>, public Trinity::O
//InstanceMaps and BattleGroundMaps...
Map* m_parentMap;
- typedef GridReadGuard ReadGuard;
- typedef GridWriteGuard WriteGuard;
-
NGridType* i_grids[MAX_NUMBER_OF_GRIDS][MAX_NUMBER_OF_GRIDS];
GridMap *GridMaps[MAX_NUMBER_OF_GRIDS][MAX_NUMBER_OF_GRIDS];
std::bitset<TOTAL_NUMBER_OF_CELLS_PER_MAP*TOTAL_NUMBER_OF_CELLS_PER_MAP> marked_cells;
@@ -659,19 +636,18 @@ Map::CalculateGridMask(const uint32 &y) const
}
*/
-template<class LOCK_TYPE, class T, class CONTAINER>
+template<class T, class CONTAINER>
inline void
-Map::Visit(const CellLock<LOCK_TYPE> &cell, TypeContainerVisitor<T, CONTAINER> &visitor)
+Map::Visit(const Cell& cell, TypeContainerVisitor<T, CONTAINER> &visitor)
{
- const uint32 x = cell->GridX();
- const uint32 y = cell->GridY();
- const uint32 cell_x = cell->CellX();
- const uint32 cell_y = cell->CellY();
+ const uint32 x = cell.GridX();
+ const uint32 y = cell.GridY();
+ const uint32 cell_x = cell.CellX();
+ const uint32 cell_y = cell.CellY();
- if( !cell->NoCreate() || loaded(GridPair(x,y)) )
+ if( !cell.NoCreate() || loaded(GridPair(x,y)) )
{
EnsureGridLoaded(cell);
- //LOCK_TYPE guard(i_info[x][y]->i_lock);
getNGrid(x, y)->Visit(cell_x, cell_y, visitor);
}
}
@@ -684,12 +660,11 @@ Map::VisitAll(const float &x, const float &y, float radius, NOTIFIER &notifier)
Cell cell(p);
cell.data.Part.reserved = ALL_DISTRICT;
cell.SetNoCreate();
- CellLock<GridReadGuard> cell_lock(cell, p);
TypeContainerVisitor<NOTIFIER, WorldTypeMapContainer> world_object_notifier(notifier);
- cell_lock->Visit(cell_lock, world_object_notifier, *this, radius, x, y);
+ cell.Visit(p, world_object_notifier, *this, radius, x, y);
TypeContainerVisitor<NOTIFIER, GridTypeMapContainer > grid_object_notifier(notifier);
- cell_lock->Visit(cell_lock, grid_object_notifier, *this, radius, x, y);
+ cell.Visit(p, grid_object_notifier, *this, radius, x, y);
}
template<class NOTIFIER>
@@ -700,10 +675,9 @@ Map::VisitWorld(const float &x, const float &y, float radius, NOTIFIER &notifier
Cell cell(p);
cell.data.Part.reserved = ALL_DISTRICT;
cell.SetNoCreate();
- CellLock<GridReadGuard> cell_lock(cell, p);
TypeContainerVisitor<NOTIFIER, WorldTypeMapContainer> world_object_notifier(notifier);
- cell_lock->Visit(cell_lock, world_object_notifier, *this, radius, x, y);
+ cell.Visit(p, world_object_notifier, *this, radius, x, y);
}
template<class NOTIFIER>
@@ -714,9 +688,8 @@ Map::VisitGrid(const float &x, const float &y, float radius, NOTIFIER &notifier)
Cell cell(p);
cell.data.Part.reserved = ALL_DISTRICT;
cell.SetNoCreate();
- CellLock<GridReadGuard> cell_lock(cell, p);
TypeContainerVisitor<NOTIFIER, GridTypeMapContainer > grid_object_notifier(notifier);
- cell_lock->Visit(cell_lock, grid_object_notifier, *this, radius, x, y);
+ cell.Visit(p, grid_object_notifier, *this, radius, x, y);
}
#endif
diff --git a/src/game/Object.cpp b/src/game/Object.cpp
index 7433113f051..c875f17fd9a 100644
--- a/src/game/Object.cpp
+++ b/src/game/Object.cpp
@@ -1546,8 +1546,7 @@ void WorldObject::MonsterSay(int32 textId, uint32 language, uint64 TargetGuid)
Trinity::LocalizedPacketDo<Trinity::MonsterChatBuilder> say_do(say_build);
Trinity::PlayerDistWorker<Trinity::LocalizedPacketDo<Trinity::MonsterChatBuilder> > say_worker(this,sWorld.getConfig(CONFIG_LISTEN_RANGE_SAY),say_do);
TypeContainerVisitor<Trinity::PlayerDistWorker<Trinity::LocalizedPacketDo<Trinity::MonsterChatBuilder> >, WorldTypeMapContainer > message(say_worker);
- CellLock<GridReadGuard> cell_lock(cell, p);
- cell_lock->Visit(cell_lock, message, *GetMap(), *this, sWorld.getConfig(CONFIG_LISTEN_RANGE_SAY));
+ cell.Visit(p, message, *GetMap(), *this, sWorld.getConfig(CONFIG_LISTEN_RANGE_SAY));
}
void WorldObject::MonsterYell(int32 textId, uint32 language, uint64 TargetGuid)
@@ -1562,8 +1561,7 @@ void WorldObject::MonsterYell(int32 textId, uint32 language, uint64 TargetGuid)
Trinity::LocalizedPacketDo<Trinity::MonsterChatBuilder> say_do(say_build);
Trinity::PlayerDistWorker<Trinity::LocalizedPacketDo<Trinity::MonsterChatBuilder> > say_worker(this,sWorld.getConfig(CONFIG_LISTEN_RANGE_YELL),say_do);
TypeContainerVisitor<Trinity::PlayerDistWorker<Trinity::LocalizedPacketDo<Trinity::MonsterChatBuilder> >, WorldTypeMapContainer > message(say_worker);
- CellLock<GridReadGuard> cell_lock(cell, p);
- cell_lock->Visit(cell_lock, message, *GetMap(), *this, sWorld.getConfig(CONFIG_LISTEN_RANGE_YELL));
+ cell.Visit(p, message, *GetMap(), *this, sWorld.getConfig(CONFIG_LISTEN_RANGE_YELL));
}
void WorldObject::MonsterYellToZone(int32 textId, uint32 language, uint64 TargetGuid)
@@ -1591,8 +1589,7 @@ void WorldObject::MonsterTextEmote(int32 textId, uint64 TargetGuid, bool IsBossE
Trinity::LocalizedPacketDo<Trinity::MonsterChatBuilder> say_do(say_build);
Trinity::PlayerDistWorker<Trinity::LocalizedPacketDo<Trinity::MonsterChatBuilder> > say_worker(this,sWorld.getConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE),say_do);
TypeContainerVisitor<Trinity::PlayerDistWorker<Trinity::LocalizedPacketDo<Trinity::MonsterChatBuilder> >, WorldTypeMapContainer > message(say_worker);
- CellLock<GridReadGuard> cell_lock(cell, p);
- cell_lock->Visit(cell_lock, message, *GetMap(), *this, sWorld.getConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE));
+ cell.Visit(p, message, *GetMap(), *this, sWorld.getConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE));
}
void WorldObject::MonsterWhisper(int32 textId, uint64 receiver, bool IsBossWhisper)
@@ -1984,8 +1981,7 @@ void WorldObject::GetGameObjectListWithEntryInGrid(std::list<GameObject*>& lList
Trinity::GameObjectListSearcher<Trinity::AllGameObjectsWithEntryInRange> searcher(this, lList, check);
TypeContainerVisitor<Trinity::GameObjectListSearcher<Trinity::AllGameObjectsWithEntryInRange>, GridTypeMapContainer> visitor(searcher);
- CellLock<GridReadGuard> cell_lock(cell, pair);
- cell_lock->Visit(cell_lock, visitor, *(this->GetMap()));
+ cell.Visit(pair, visitor, *(this->GetMap()));
}
void WorldObject::GetCreatureListWithEntryInGrid(std::list<Creature*>& lList, uint32 uiEntry, float fMaxSearchRange)
@@ -1999,8 +1995,7 @@ void WorldObject::GetCreatureListWithEntryInGrid(std::list<Creature*>& lList, ui
Trinity::CreatureListSearcher<Trinity::AllCreaturesOfEntryInRange> searcher(this, lList, check);
TypeContainerVisitor<Trinity::CreatureListSearcher<Trinity::AllCreaturesOfEntryInRange>, GridTypeMapContainer> visitor(searcher);
- CellLock<GridReadGuard> cell_lock(cell, pair);
- cell_lock->Visit(cell_lock, visitor, *(this->GetMap()));
+ cell.Visit(pair, visitor, *(this->GetMap()));
}
/*
diff --git a/src/game/ObjectAccessor.cpp b/src/game/ObjectAccessor.cpp
index 787a40252e2..92cdb81ea24 100644
--- a/src/game/ObjectAccessor.cpp
+++ b/src/game/ObjectAccessor.cpp
@@ -238,10 +238,9 @@ ObjectAccessor::_buildChangeObjectForPlayer(WorldObject *obj, UpdateDataMapType
cell.SetNoCreate();
WorldObjectChangeAccumulator notifier(*obj, update_players);
TypeContainerVisitor<WorldObjectChangeAccumulator, WorldTypeMapContainer > player_notifier(notifier);
- CellLock<GridReadGuard> cell_lock(cell, p);
Map& map = *obj->GetMap();
//we must build packets for all visible players
- cell_lock->Visit(cell_lock, player_notifier, map, *obj, map.GetVisibilityDistance());
+ cell.Visit(p, player_notifier, map, *obj, map.GetVisibilityDistance());
}
Pet*
diff --git a/src/game/ScriptedCreature.cpp b/src/game/ScriptedCreature.cpp
index 204b5b266b1..5868b7e2fe9 100644
--- a/src/game/ScriptedCreature.cpp
+++ b/src/game/ScriptedCreature.cpp
@@ -501,8 +501,7 @@ Player* ScriptedAI::GetPlayerAtMinimumRange(float fMinimumRange)
Trinity::PlayerSearcher<Trinity::PlayerAtMinimumRangeAway> searcher(m_creature, pPlayer, check);
TypeContainerVisitor<Trinity::PlayerSearcher<Trinity::PlayerAtMinimumRangeAway>, GridTypeMapContainer> visitor(searcher);
- CellLock<GridReadGuard> cell_lock(cell, pair);
- cell_lock->Visit(cell_lock, visitor, *(m_creature->GetMap()));
+ cell.Visit(pair, visitor, *(m_creature->GetMap()));
return pPlayer;
}
diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp
index 362c9c7bf21..b213aa71a88 100644
--- a/src/game/Spell.cpp
+++ b/src/game/Spell.cpp
@@ -516,13 +516,12 @@ WorldObject* Spell::FindCorpseUsing()
Trinity::WorldObjectSearcher<T> searcher(m_caster, result, u_check);
TypeContainerVisitor<Trinity::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<Trinity::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;
@@ -5687,9 +5686,8 @@ SpellCastResult Spell::CheckItems()
Trinity::GameObjectSearcher<Trinity::GameObjectFocusCheck> checker(m_caster, ok, go_check);
TypeContainerVisitor<Trinity::GameObjectSearcher<Trinity::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;
diff --git a/src/game/SpellAuraEffects.cpp b/src/game/SpellAuraEffects.cpp
index 4ec66906aab..c78c9815913 100644
--- a/src/game/SpellAuraEffects.cpp
+++ b/src/game/SpellAuraEffects.cpp
@@ -1814,10 +1814,8 @@ void AuraEffect::PeriodicDummyTick(Unit * target, Unit * caster) const
TypeContainerVisitor<Trinity::UnitListSearcher<Trinity::AnyUnfriendlyVisibleUnitInObjectRangeCheck>, GridTypeMapContainer > grid_object_checker(checker);
TypeContainerVisitor<Trinity::UnitListSearcher<Trinity::AnyUnfriendlyVisibleUnitInObjectRangeCheck>, WorldTypeMapContainer > world_object_checker(checker);
- CellLock<GridReadGuard> cell_lock(cell, p);
-
- cell_lock->Visit(cell_lock, grid_object_checker, *GetBase()->GetOwner()->GetMap(), *caster, radius);
- cell_lock->Visit(cell_lock, world_object_checker, *GetBase()->GetOwner()->GetMap(), *caster, radius);
+ cell.Visit(p, grid_object_checker, *GetBase()->GetOwner()->GetMap(), *caster, radius);
+ cell.Visit(p, world_object_checker, *GetBase()->GetOwner()->GetMap(), *caster, radius);
}
if(targets.empty())
diff --git a/src/scripts/eastern_kingdoms/sunwell_plateau/boss_felmyst.cpp b/src/scripts/eastern_kingdoms/sunwell_plateau/boss_felmyst.cpp
index 12014ffdbe3..6e680a16f19 100644
--- a/src/scripts/eastern_kingdoms/sunwell_plateau/boss_felmyst.cpp
+++ b/src/scripts/eastern_kingdoms/sunwell_plateau/boss_felmyst.cpp
@@ -530,8 +530,7 @@ struct TRINITY_DLL_DECL boss_felmystAI : public ScriptedAI
TypeContainerVisitor<Trinity::CreatureListSearcher<Trinity::AllCreaturesOfEntryInRange>, GridTypeMapContainer> cSearcher(searcher);
- CellLock<GridReadGuard> cell_lock(cell, pair);
- cell_lock->Visit(cell_lock, cSearcher, *(m_creature->GetMap()));
+ cell.Visit(pair, cSearcher, *(m_creature->GetMap()));
}
for (std::list<Creature*>::iterator i = templist.begin(); i != templist.end(); ++i)
diff --git a/src/scripts/eastern_kingdoms/sunwell_plateau/boss_kiljaeden.cpp b/src/scripts/eastern_kingdoms/sunwell_plateau/boss_kiljaeden.cpp
index 578d8af0c3a..d85af40496e 100644
--- a/src/scripts/eastern_kingdoms/sunwell_plateau/boss_kiljaeden.cpp
+++ b/src/scripts/eastern_kingdoms/sunwell_plateau/boss_kiljaeden.cpp
@@ -341,10 +341,11 @@ struct TRINITY_DLL_DECL boss_kalecgos_kjAI : public ScriptedAI
AllOrbsInGrid check;
Trinity::GameObjectListSearcher<AllOrbsInGrid> searcher(me, orbList, check);
TypeContainerVisitor<Trinity::GameObjectListSearcher<AllOrbsInGrid>, GridTypeMapContainer> visitor(searcher);
- CellLock<GridReadGuard> cell_lock(cell, pair);
- cell_lock->Visit(cell_lock, visitor, *(m_creature->GetMap()));
+ cell.Visit(pair, visitor, *(m_creature->GetMap()));
+
if (orbList.empty())
return;
+
uint8 i = 0;
for (std::list<GameObject*>::iterator itr = orbList.begin(); itr != orbList.end(); ++itr, ++i){
Orb[i] = pInstance ? pInstance->instance->GetGameObject(pInstance->GetData64((*itr)->GetGUID())) : NULL;
diff --git a/src/scripts/eastern_kingdoms/zulaman/boss_akilzon.cpp b/src/scripts/eastern_kingdoms/zulaman/boss_akilzon.cpp
index 40bff5f552f..825059efd67 100644
--- a/src/scripts/eastern_kingdoms/zulaman/boss_akilzon.cpp
+++ b/src/scripts/eastern_kingdoms/zulaman/boss_akilzon.cpp
@@ -193,9 +193,8 @@ struct TRINITY_DLL_DECL boss_akilzonAI : public ScriptedAI
TypeContainerVisitor<Trinity::UnitListSearcher<Trinity::AnyAoETargetUnitInObjectRangeCheck>, WorldTypeMapContainer > world_unit_searcher(searcher);
TypeContainerVisitor<Trinity::UnitListSearcher<Trinity::AnyAoETargetUnitInObjectRangeCheck>, GridTypeMapContainer > grid_unit_searcher(searcher);
- CellLock<GridReadGuard> cell_lock(cell, p);
- cell_lock->Visit(cell_lock, world_unit_searcher, *(m_creature->GetMap()));
- cell_lock->Visit(cell_lock, grid_unit_searcher, *(m_creature->GetMap()));
+ cell.Visit(p, world_unit_searcher, *(m_creature->GetMap()));
+ cell.Visit(p, grid_unit_searcher, *(m_creature->GetMap()));
}
//dealdamege
for (std::list<Unit*>::iterator i = tempUnitMap.begin(); i != tempUnitMap.end(); ++i)
diff --git a/src/scripts/eastern_kingdoms/zulaman/boss_janalai.cpp b/src/scripts/eastern_kingdoms/zulaman/boss_janalai.cpp
index aef4b337a97..905fd45d420 100644
--- a/src/scripts/eastern_kingdoms/zulaman/boss_janalai.cpp
+++ b/src/scripts/eastern_kingdoms/zulaman/boss_janalai.cpp
@@ -239,8 +239,7 @@ struct TRINITY_DLL_DECL boss_janalaiAI : public ScriptedAI
TypeContainerVisitor<Trinity::CreatureListSearcher<Trinity::AllCreaturesOfEntryInRange>, GridTypeMapContainer> cSearcher(searcher);
- CellLock<GridReadGuard> cell_lock(cell, pair);
- cell_lock->Visit(cell_lock, cSearcher, *(m_creature->GetMap()));
+ cell.Visit(pair, cSearcher, *(m_creature->GetMap()));
}
//error_log("Eggs %d at middle", templist.size());
@@ -274,8 +273,7 @@ struct TRINITY_DLL_DECL boss_janalaiAI : public ScriptedAI
TypeContainerVisitor<Trinity::CreatureListSearcher<Trinity::AllCreaturesOfEntryInRange>, GridTypeMapContainer> cSearcher(searcher);
- CellLock<GridReadGuard> cell_lock(cell, pair);
- cell_lock->Visit(cell_lock, cSearcher, *(m_creature->GetMap()));
+ cell.Visit(pair, cSearcher, *(m_creature->GetMap()));
}
for (std::list<Creature*>::iterator i = templist.begin(); i != templist.end(); ++i)
{
@@ -507,8 +505,7 @@ struct TRINITY_DLL_DECL mob_amanishi_hatcherAI : public ScriptedAI
TypeContainerVisitor<Trinity::CreatureListSearcher<Trinity::AllCreaturesOfEntryInRange>, GridTypeMapContainer> cSearcher(searcher);
- CellLock<GridReadGuard> cell_lock(cell, pair);
- cell_lock->Visit(cell_lock, cSearcher, *(m_creature->GetMap()));
+ cell.Visit(pair, cSearcher, *(m_creature->GetMap()));
}
//error_log("Eggs %d at %d", templist.size(), side);
diff --git a/src/scripts/eastern_kingdoms/zulaman/boss_nalorakk.cpp b/src/scripts/eastern_kingdoms/zulaman/boss_nalorakk.cpp
index 1c234716fe4..a694ba8d346 100644
--- a/src/scripts/eastern_kingdoms/zulaman/boss_nalorakk.cpp
+++ b/src/scripts/eastern_kingdoms/zulaman/boss_nalorakk.cpp
@@ -161,8 +161,7 @@ struct TRINITY_DLL_DECL boss_nalorakkAI : public ScriptedAI
TypeContainerVisitor<Trinity::CreatureListSearcher<Trinity::AllFriendlyCreaturesInGrid>, GridTypeMapContainer> cSearcher(searcher);
- CellLock<GridReadGuard> cell_lock(cell, pair);
- cell_lock->Visit(cell_lock, cSearcher, *(m_creature->GetMap()));
+ cell.Visit(pair, cSearcher, *(m_creature->GetMap()));
}
if (!templist.size())
diff --git a/src/scripts/kalimdor/caverns_of_time/hyjal/hyjalAI.cpp b/src/scripts/kalimdor/caverns_of_time/hyjal/hyjalAI.cpp
index ea73232072b..c6d77c0f966 100644
--- a/src/scripts/kalimdor/caverns_of_time/hyjal/hyjalAI.cpp
+++ b/src/scripts/kalimdor/caverns_of_time/hyjal/hyjalAI.cpp
@@ -945,9 +945,8 @@ void hyjalAI::HideNearPos(float x, float y)
<Trinity::CreatureListSearcher<Trinity::AllFriendlyCreaturesInGrid>,
GridTypeMapContainer> creature_visitor(creature_searcher);
- CellLock<GridReadGuard> cell_lock(cell, pair);
// Get Creatures
- cell_lock->Visit(cell_lock, creature_visitor, *(m_creature->GetMap()));
+ cell.Visit(pair, creature_visitor, *(m_creature->GetMap()));
if (!creatures.empty())
{
@@ -968,8 +967,7 @@ void hyjalAI::RespawnNearPos(float x, float y)
Trinity::RespawnDo u_do;
Trinity::WorldObjectWorker<Trinity::RespawnDo> worker(m_creature, u_do);
TypeContainerVisitor<Trinity::WorldObjectWorker<Trinity::RespawnDo>, GridTypeMapContainer > obj_worker(worker);
- CellLock<GridReadGuard> cell_lock(cell, p);
- cell_lock->Visit(cell_lock, obj_worker, *m_creature->GetMap());
+ cell.Visit(p, obj_worker, *m_creature->GetMap());
}
void hyjalAI::WaypointReached(uint32 i)
{
@@ -1005,8 +1003,7 @@ void hyjalAI::WaypointReached(uint32 i)
<Trinity::CreatureListSearcher<Trinity::AllFriendlyCreaturesInGrid>,
GridTypeMapContainer> creature_visitor(creature_searcher);
- CellLock<GridReadGuard> cell_lock(cell, pair);
- cell_lock->Visit(cell_lock, creature_visitor, *(m_creature->GetMap()));
+ cell.Visit(pair, creature_visitor, *(m_creature->GetMap()));
if (!creatures.empty())
{
@@ -1047,8 +1044,7 @@ void hyjalAI::DoOverrun(uint32 faction, const uint32 diff)
<Trinity::CreatureListSearcher<Trinity::AllFriendlyCreaturesInGrid>,
GridTypeMapContainer> creature_visitor(creature_searcher);
- CellLock<GridReadGuard> cell_lock(cell, pair);
- cell_lock->Visit(cell_lock, creature_visitor, *(m_creature->GetMap()));
+ cell.Visit(pair, creature_visitor, *(m_creature->GetMap()));
if (!creatures.empty())
{