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

References i_playerSet.

Member Function Documentation

◆ BuildPacket()

void WorldObjectChangeAccumulator::BuildPacket ( Player player)
inline
3063 {
3064 // Only send update once to a player
3065 if (i_playerSet.find(player->GetGUID()) == i_playerSet.end() && player->HaveAtClient(&i_object))
3066 {
3068 i_playerSet.insert(player->GetGUID());
3069 }
3070 }
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:11408

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
3030 {
3031 Creature* source = nullptr;
3032 for (CreatureMapType::iterator iter = m.begin(); iter != m.end(); ++iter)
3033 {
3034 source = iter->GetSource();
3035 if (source->HasSharedVision())
3036 {
3037 SharedVisionList::const_iterator it = source->GetSharedVisionList().begin();
3038 for (; it != source->GetSharedVisionList().end(); ++it)
3039 BuildPacket(*it);
3040 }
3041 }
3042 }
Definition: LinkedList.h:139
Definition: Creature.h:46
void BuildPacket(Player *player)
Definition: Object.cpp:3062
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
3045 {
3046 DynamicObject* source = nullptr;
3047 for (DynamicObjectMapType::iterator iter = m.begin(); iter != m.end(); ++iter)
3048 {
3049 source = iter->GetSource();
3050 ObjectGuid guid = source->GetCasterGUID();
3051
3052 if (guid)
3053 {
3054 //Caster may be nullptr if DynObj is in removelist
3055 if (Player* caster = ObjectAccessor::FindPlayer(guid))
3056 if (caster->GetGuidValue(PLAYER_FARSIGHT) == source->GetGUID())
3057 BuildPacket(caster);
3058 }
3059 }
3060 }
@ 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
3072{}

◆ Visit() [4/4]

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

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