TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Trinity::LocalizedPacketListDo< Builder > Class Template Reference

#include <GridNotifiers.h>

Public Types

typedef std::vector
< WorldPackets::Packet * > 
WorldPacketList
 

Public Member Functions

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

Private Attributes

Builder & i_builder
 
std::vector< WorldPacketListi_data_cache
 

Member Typedef Documentation

template<class Builder>
typedef std::vector<WorldPackets::Packet*> Trinity::LocalizedPacketListDo< Builder >::WorldPacketList

Constructor & Destructor Documentation

template<class Builder>
Trinity::LocalizedPacketListDo< Builder >::LocalizedPacketListDo ( Builder &  builder)
inlineexplicit
1423 : i_builder(builder) { }
Builder & i_builder
Definition: GridNotifiers.h:1434
template<class Builder>
Trinity::LocalizedPacketListDo< Builder >::~LocalizedPacketListDo ( )
inline
1426  {
1427  for (size_t i = 0; i < i_data_cache.size(); ++i)
1428  for (size_t j = 0; j < i_data_cache[i].size(); ++j)
1429  delete i_data_cache[i][j];
1430  }
std::vector< WorldPacketList > i_data_cache
Definition: GridNotifiers.h:1435

Member Function Documentation

template<class Builder >
void Trinity::LocalizedPacketListDo< Builder >::operator() ( Player *  p)
590 {
591  LocaleConstant loc_idx = p->GetSession()->GetSessionDbLocaleIndex();
592  uint32 cache_idx = loc_idx+1;
593  WorldPacketList* data_list;
594 
595  // create if not cached yet
596  if (i_data_cache.size() < cache_idx+1 || i_data_cache[cache_idx].empty())
597  {
598  if (i_data_cache.size() < cache_idx+1)
599  i_data_cache.resize(cache_idx+1);
600 
601  data_list = &i_data_cache[cache_idx];
602 
603  i_builder(*data_list, loc_idx);
604  }
605  else
606  data_list = &i_data_cache[cache_idx];
607 
608  for (size_t i = 0; i < data_list->size(); ++i)
609  p->SendDirectMessage((*data_list)[i]->GetRawPacket());
610 }
Builder & i_builder
Definition: GridNotifiers.h:1434
std::vector< WorldPackets::Packet * > WorldPacketList
Definition: GridNotifiers.h:1422
LocaleConstant
Definition: Common.h:115
uint32_t uint32
Definition: Define.h:150
std::vector< WorldPacketList > i_data_cache
Definition: GridNotifiers.h:1435

Member Data Documentation

template<class Builder>
Builder& Trinity::LocalizedPacketListDo< Builder >::i_builder
private
template<class Builder>
std::vector<WorldPacketList> Trinity::LocalizedPacketListDo< Builder >::i_data_cache
private

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