AzeorthCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
WorldObjectChangeAccumulator Struct Reference

Public Member Functions

 WorldObjectChangeAccumulator (WorldObject &obj, UpdateDataMapType &d, UpdatePlayerSet &p)
 
void Visit (PlayerMapType &m)
 
void Visit (CreatureMapType &m)
 
void Visit (DynamicObjectMapType &m)
 
void BuildPacket (Player *player)
 
template<class SKIP >
void Visit (GridRefMgr< SKIP > &)
 

Public Attributes

UpdateDataMapTypei_updateDatas
 
UpdatePlayerSeti_playerSet
 
WorldObjecti_object
 

Detailed Description

Constructor & Destructor Documentation

◆ WorldObjectChangeAccumulator()

WorldObjectChangeAccumulator::WorldObjectChangeAccumulator ( WorldObject obj,
UpdateDataMapType d,
UpdatePlayerSet p 
)
inline
2924 : i_updateDatas(d), i_playerSet(p), i_object(obj)
2925 {
2926 i_playerSet.clear();
2927 }
UpdatePlayerSet & i_playerSet
Definition: Object.cpp:2922
UpdateDataMapType & i_updateDatas
Definition: Object.cpp:2921
WorldObject & i_object
Definition: Object.cpp:2923

References i_playerSet.

Member Function Documentation

◆ BuildPacket()

void WorldObjectChangeAccumulator::BuildPacket ( Player player)
inline
2980 {
2981 // Only send update once to a player
2982 if (i_playerSet.find(player->GetGUID()) == i_playerSet.end() && player->HaveAtClient(&i_object))
2983 {
2985 i_playerSet.insert(player->GetGUID());
2986 }
2987 }
void BuildFieldsUpdate(Player *, UpdateDataMapType &) const
Definition: Object.cpp:545
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:106
bool HaveAtClient(WorldObject const *u) const
Definition: Player.h:2333

References Object::BuildFieldsUpdate(), Object::GetGUID(), Player::HaveAtClient(), i_object, i_playerSet, and i_updateDatas.

Referenced by Visit().

◆ Visit() [1/4]

void WorldObjectChangeAccumulator::Visit ( CreatureMapType m)
inline
2947 {
2948 Creature* source = nullptr;
2949 for (CreatureMapType::iterator iter = m.begin(); iter != m.end(); ++iter)
2950 {
2951 source = iter->GetSource();
2952 if (source->HasSharedVision())
2953 {
2954 SharedVisionList::const_iterator it = source->GetSharedVisionList().begin();
2955 for (; it != source->GetSharedVisionList().end(); ++it)
2956 BuildPacket(*it);
2957 }
2958 }
2959 }
Definition: LinkedList.h:139
Definition: Creature.h:46
void BuildPacket(Player *player)
Definition: Object.cpp:2979
SharedVisionList const & GetSharedVisionList()
Definition: Unit.h:1889
bool HasSharedVision() const
Definition: Unit.h:1892
iterator begin()
Definition: GridRefMgr.h:35
iterator end()
Definition: GridRefMgr.h:36

References GridRefMgr< OBJECT >::begin(), BuildPacket(), GridRefMgr< OBJECT >::end(), Unit::GetSharedVisionList(), and Unit::HasSharedVision().

◆ Visit() [2/4]

void WorldObjectChangeAccumulator::Visit ( DynamicObjectMapType m)
inline
2962 {
2963 DynamicObject* source = nullptr;
2964 for (DynamicObjectMapType::iterator iter = m.begin(); iter != m.end(); ++iter)
2965 {
2966 source = iter->GetSource();
2967 ObjectGuid guid = source->GetCasterGUID();
2968
2969 if (guid)
2970 {
2971 //Caster may be nullptr if DynObj is in removelist
2972 if (Player* caster = ObjectAccessor::FindPlayer(guid))
2973 if (caster->GetGuidValue(PLAYER_FARSIGHT) == source->GetGUID())
2974 BuildPacket(caster);
2975 }
2976 }
2977 }
@ PLAYER_FARSIGHT
Definition: UpdateFields.h:334
Player * FindPlayer(ObjectGuid const guid)
Definition: ObjectAccessor.cpp:250
Definition: DynamicObject.h:35
ObjectGuid GetCasterGUID() const
Definition: DynamicObject.h:59
Definition: ObjectGuid.h:120
Definition: Player.h:1046

References GridRefMgr< OBJECT >::begin(), BuildPacket(), GridRefMgr< OBJECT >::end(), ObjectAccessor::FindPlayer(), DynamicObject::GetCasterGUID(), Object::GetGUID(), and PLAYER_FARSIGHT.

◆ Visit() [3/4]

template<class SKIP >
void WorldObjectChangeAccumulator::Visit ( GridRefMgr< SKIP > &  )
inline
2989{}

◆ Visit() [4/4]

void WorldObjectChangeAccumulator::Visit ( PlayerMapType m)
inline
2929 {
2930 Player* source = nullptr;
2931 for (PlayerMapType::iterator iter = m.begin(); iter != m.end(); ++iter)
2932 {
2933 source = iter->GetSource();
2934
2935 BuildPacket(source);
2936
2937 if (source->HasSharedVision())
2938 {
2939 SharedVisionList::const_iterator it = source->GetSharedVisionList().begin();
2940 for (; it != source->GetSharedVisionList().end(); ++it)
2941 BuildPacket(*it);
2942 }
2943 }
2944 }

References GridRefMgr< OBJECT >::begin(), BuildPacket(), GridRefMgr< OBJECT >::end(), Unit::GetSharedVisionList(), and Unit::HasSharedVision().

Member Data Documentation

◆ i_object

WorldObject& WorldObjectChangeAccumulator::i_object

Referenced by BuildPacket().

◆ i_playerSet

UpdatePlayerSet& WorldObjectChangeAccumulator::i_playerSet

◆ i_updateDatas

UpdateDataMapType& WorldObjectChangeAccumulator::i_updateDatas

Referenced by BuildPacket().