TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Trinity::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
< WorldPackets::Packet * > 
i_data_cache
 

Constructor & Destructor Documentation

template<class Builder>
Trinity::LocalizedPacketDo< Builder >::LocalizedPacketDo ( Builder &  builder)
inlineexplicit
1403 : i_builder(builder) { }
Builder & i_builder
Definition: GridNotifiers.h:1413
template<class Builder>
Trinity::LocalizedPacketDo< Builder >::~LocalizedPacketDo ( )
inline
1406  {
1407  for (size_t i = 0; i < i_data_cache.size(); ++i)
1408  delete i_data_cache[i];
1409  }
std::vector< WorldPackets::Packet * > i_data_cache
Definition: GridNotifiers.h:1414

Member Function Documentation

template<class Builder >
void Trinity::LocalizedPacketDo< Builder >::operator() ( Player *  p)
563 {
564  LocaleConstant loc_idx = p->GetSession()->GetSessionDbLocaleIndex();
565  uint32 cache_idx = loc_idx+1;
566  WorldPackets::Packet* data;
567 
568  // create if not cached yet
569  if (i_data_cache.size() < cache_idx + 1 || !i_data_cache[cache_idx])
570  {
571  if (i_data_cache.size() < cache_idx + 1)
572  i_data_cache.resize(cache_idx + 1);
573 
574  data = i_builder(loc_idx);
575 
576  ASSERT(data->GetSize() == 0);
577 
578  data->Write();
579 
580  i_data_cache[cache_idx] = data;
581  }
582  else
583  data = i_data_cache[cache_idx];
584 
585  p->SendDirectMessage(data->GetRawPacket());
586 }
LocaleConstant
Definition: Common.h:115
Definition: Packet.h:25
WorldPacket const * GetRawPacket() const
Definition: Packet.h:38
uint32_t uint32
Definition: Define.h:150
Builder & i_builder
Definition: GridNotifiers.h:1413
std::vector< WorldPackets::Packet * > i_data_cache
Definition: GridNotifiers.h:1414
size_t GetSize() const
Definition: Packet.h:39
virtual WorldPacket const * Write()=0
#define ASSERT
Definition: Errors.h:55

+ Here is the call graph for this function:

Member Data Documentation

template<class Builder>
Builder& Trinity::LocalizedPacketDo< Builder >::i_builder
private
template<class Builder>
std::vector<WorldPackets::Packet*> Trinity::LocalizedPacketDo< Builder >::i_data_cache
private

The documentation for this class was generated from the following files: