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)
540{
542 uint32 cache_idx = loc_idx + 1;
543 WorldPacket* data;
544
545 // create if not cached yet
546 if (i_data_cache.size() < cache_idx + 1 || !i_data_cache[cache_idx])
547 {
548 if (i_data_cache.size() < cache_idx + 1)
549 i_data_cache.resize(cache_idx + 1);
550
551 data = new WorldPacket();
552
553 i_builder(*data, loc_idx);
554
555 i_data_cache[cache_idx] = data;
556 }
557 else
558 data = i_data_cache[cache_idx];
559
560 p->SendDirectMessage(data);
561}
LocaleConstant
Definition: Common.h:65
std::uint32_t uint32
Definition: Define.h:107
void SendDirectMessage(WorldPacket const *data) const
Definition: Player.cpp:5692
WorldSession * GetSession() const
Definition: Player.h:1978
Definition: WorldPacket.h:27
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