* 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
This commit is contained in:
XTZGZoReX
2010-01-23 22:24:41 +01:00
parent fe07518baf
commit 9f00ca3eb8
24 changed files with 110 additions and 212 deletions
+1 -2
View File
@@ -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);
+4 -23
View File
@@ -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
+24 -31
View File
@@ -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);
}
}
}
+1 -2
View File
@@ -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;
+1 -2
View File
@@ -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);
+5 -9
View File
@@ -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
+3 -6
View File
@@ -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());
}
//*********************************
+2 -5
View File
@@ -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;
}
+4 -4
View File
@@ -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); }
+2 -2
View File
@@ -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);
}
+1 -2
View File
@@ -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;
}
+24 -39
View File
@@ -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
{
+12 -39
View File
@@ -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
+5 -10
View File
@@ -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()));
}
/*
+1 -2
View File
@@ -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*
+1 -2
View File
@@ -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;
}
+3 -5
View File
@@ -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;
+2 -4
View File
@@ -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())
@@ -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)
@@ -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;
@@ -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)
@@ -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);
@@ -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())
@@ -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())
{