AzerothCore 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
3020 : i_updateDatas(d), i_playerSet(p), i_object(obj)
3021 {
3022 i_playerSet.clear();
3023 }
UpdatePlayerSet & i_playerSet
Definition: Object.cpp:3018
UpdateDataMapType & i_updateDatas
Definition: Object.cpp:3017
WorldObject & i_object
Definition: Object.cpp:3019

References i_playerSet.

Member Function Documentation

◆ BuildPacket()

void WorldObjectChangeAccumulator::BuildPacket ( Player player)
inline
3076 {
3077 // Only send update once to a player
3078 if (i_playerSet.find(player->GetGUID()) == i_playerSet.end() && player->HaveAtClient(&i_object))
3079 {
3081 i_playerSet.insert(player->GetGUID());
3082 }
3083 }
void BuildFieldsUpdate(Player *, UpdateDataMapType &)
Definition: Object.cpp:545
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:112
bool HaveAtClient(WorldObject const *u) const
Definition: Player.cpp:11444

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
3043 {
3044 Creature* source = nullptr;
3045 for (CreatureMapType::iterator iter = m.begin(); iter != m.end(); ++iter)
3046 {
3047 source = iter->GetSource();
3048 if (source->HasSharedVision())
3049 {
3050 SharedVisionList::const_iterator it = source->GetSharedVisionList().begin();
3051 for (; it != source->GetSharedVisionList().end(); ++it)
3052 BuildPacket(*it);
3053 }
3054 }
3055 }
Definition: LinkedList.h:139
Definition: Creature.h:43
void BuildPacket(Player *player)
Definition: Object.cpp:3075
SharedVisionList const & GetSharedVisionList()
Definition: Unit.h:1737
bool HasSharedVision() const
Definition: Unit.h:1740
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
3058 {
3059 DynamicObject* source = nullptr;
3060 for (DynamicObjectMapType::iterator iter = m.begin(); iter != m.end(); ++iter)
3061 {
3062 source = iter->GetSource();
3063 ObjectGuid guid = source->GetCasterGUID();
3064
3065 if (guid)
3066 {
3067 //Caster may be nullptr if DynObj is in removelist
3068 if (Player* caster = ObjectAccessor::FindPlayer(guid))
3069 if (caster->GetGuidValue(PLAYER_FARSIGHT) == source->GetGUID())
3070 BuildPacket(caster);
3071 }
3072 }
3073 }
@ PLAYER_FARSIGHT
Definition: UpdateFields.h:334
Player * FindPlayer(ObjectGuid const guid)
Definition: ObjectAccessor.cpp:245
Definition: DynamicObject.h:35
ObjectGuid GetCasterGUID() const
Definition: DynamicObject.h:59
Definition: ObjectGuid.h:118
Definition: Player.h:1081

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
3085{}

◆ Visit() [4/4]

void WorldObjectChangeAccumulator::Visit ( PlayerMapType m)
inline
3025 {
3026 Player* source = nullptr;
3027 for (PlayerMapType::iterator iter = m.begin(); iter != m.end(); ++iter)
3028 {
3029 source = iter->GetSource();
3030
3031 BuildPacket(source);
3032
3033 if (source->HasSharedVision())
3034 {
3035 SharedVisionList::const_iterator it = source->GetSharedVisionList().begin();
3036 for (; it != source->GetSharedVisionList().end(); ++it)
3037 BuildPacket(*it);
3038 }
3039 }
3040 }

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().