AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
Acore::LocalizedPacketDo< Builder > Class Template Reference

#include "GridNotifiers.h"

Public Member Functions

 LocalizedPacketDo (Builder &builder)
 
 ~LocalizedPacketDo ()
 
void operator() (Player *p)
 

Private Attributes

Builder & i_builder
 
std::vector< WorldPacket * > i_data_cache
 

Detailed Description

template<class Builder>
class Acore::LocalizedPacketDo< Builder >

Constructor & Destructor Documentation

◆ LocalizedPacketDo()

template<class Builder >
Acore::LocalizedPacketDo< Builder >::LocalizedPacketDo ( Builder &  builder)
inlineexplicit
1709: i_builder(builder) {}
Builder & i_builder
Definition: GridNotifiers.h:1719

◆ ~LocalizedPacketDo()

template<class Builder >
Acore::LocalizedPacketDo< Builder >::~LocalizedPacketDo ( )
inline
1712 {
1713 for (std::size_t i = 0; i < i_data_cache.size(); ++i)
1714 delete i_data_cache[i];
1715 }
std::vector< WorldPacket * > i_data_cache
Definition: GridNotifiers.h:1720

References Acore::LocalizedPacketDo< Builder >::i_data_cache.

Member Function Documentation

◆ operator()()

template<class Builder >
void Acore::LocalizedPacketDo< Builder >::operator() ( Player p)
536{
538 uint32 cache_idx = loc_idx + 1;
539 WorldPacket* data;
540
541 // create if not cached yet
542 if (i_data_cache.size() < cache_idx + 1 || !i_data_cache[cache_idx])
543 {
544 if (i_data_cache.size() < cache_idx + 1)
545 i_data_cache.resize(cache_idx + 1);
546
547 data = new WorldPacket();
548
549 i_builder(*data, loc_idx);
550
551 i_data_cache[cache_idx] = data;
552 }
553 else
554 data = i_data_cache[cache_idx];
555
556 p->SendDirectMessage(data);
557}
LocaleConstant
Definition: Common.h:65
std::uint32_t uint32
Definition: Define.h:107
void SendDirectMessage(WorldPacket const *data) const
Definition: Player.cpp:5723
WorldSession * GetSession() const
Definition: Player.h:1998
Definition: WorldPacket.h:26
LocaleConstant GetSessionDbLocaleIndex() const
Definition: WorldSession.h:498

References Player::GetSession(), WorldSession::GetSessionDbLocaleIndex(), ByteBuffer::resize(), and Player::SendDirectMessage().

Member Data Documentation

◆ i_builder

template<class Builder >
Builder& Acore::LocalizedPacketDo< Builder >::i_builder
private

◆ i_data_cache

template<class Builder >
std::vector<WorldPacket*> Acore::LocalizedPacketDo< Builder >::i_data_cache
private