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
3004 : i_updateDatas(d), i_playerSet(p), i_object(obj)
3005 {
3006 i_playerSet.clear();
3007 }
UpdatePlayerSet & i_playerSet
Definition: Object.cpp:3002
UpdateDataMapType & i_updateDatas
Definition: Object.cpp:3001
WorldObject & i_object
Definition: Object.cpp:3003

References i_playerSet.

Member Function Documentation

◆ BuildPacket()

void WorldObjectChangeAccumulator::BuildPacket ( Player player)
inline
3060 {
3061 // Only send update once to a player
3062 if (i_playerSet.find(player->GetGUID()) == i_playerSet.end() && player->HaveAtClient(&i_object))
3063 {
3065 i_playerSet.insert(player->GetGUID());
3066 }
3067 }
void BuildFieldsUpdate(Player *, UpdateDataMapType &)
Definition: Object.cpp:545
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:109
bool HaveAtClient(WorldObject const *u) const
Definition: Player.cpp:11365

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
3027 {
3028 Creature* source = nullptr;
3029 for (CreatureMapType::iterator iter = m.begin(); iter != m.end(); ++iter)
3030 {
3031 source = iter->GetSource();
3032 if (source->HasSharedVision())
3033 {
3034 SharedVisionList::const_iterator it = source->GetSharedVisionList().begin();
3035 for (; it != source->GetSharedVisionList().end(); ++it)
3036 BuildPacket(*it);
3037 }
3038 }
3039 }
Definition: LinkedList.h:139
Definition: Creature.h:46
void BuildPacket(Player *player)
Definition: Object.cpp:3059
SharedVisionList const & GetSharedVisionList()
Definition: Unit.h:1284
bool HasSharedVision() const
Definition: Unit.h:1287
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
3042 {
3043 DynamicObject* source = nullptr;
3044 for (DynamicObjectMapType::iterator iter = m.begin(); iter != m.end(); ++iter)
3045 {
3046 source = iter->GetSource();
3047 ObjectGuid guid = source->GetCasterGUID();
3048
3049 if (guid)
3050 {
3051 //Caster may be nullptr if DynObj is in removelist
3052 if (Player* caster = ObjectAccessor::FindPlayer(guid))
3053 if (caster->GetGuidValue(PLAYER_FARSIGHT) == source->GetGUID())
3054 BuildPacket(caster);
3055 }
3056 }
3057 }
@ PLAYER_FARSIGHT
Definition: UpdateFields.h:334
Player * FindPlayer(ObjectGuid const guid)
Definition: ObjectAccessor.cpp:248
Definition: DynamicObject.h:35
ObjectGuid GetCasterGUID() const
Definition: DynamicObject.h:59
Definition: ObjectGuid.h:118
Definition: Player.h:1064

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

◆ Visit() [4/4]

void WorldObjectChangeAccumulator::Visit ( PlayerMapType m)
inline
3009 {
3010 Player* source = nullptr;
3011 for (PlayerMapType::iterator iter = m.begin(); iter != m.end(); ++iter)
3012 {
3013 source = iter->GetSource();
3014
3015 BuildPacket(source);
3016
3017 if (source->HasSharedVision())
3018 {
3019 SharedVisionList::const_iterator it = source->GetSharedVisionList().begin();
3020 for (; it != source->GetSharedVisionList().end(); ++it)
3021 BuildPacket(*it);
3022 }
3023 }
3024 }

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