SEGS  0.4.2
Super Entity Game Server
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TeamLooking.h
Go to the documentation of this file.
1 /*
2  * SEGS - Super Entity Game Server
3  * http://www.segs.io/
4  * Copyright (c) 2006 - 2018 SEGS Team (see Authors.txt)
5  * This software is licensed! (See License.txt for details)
6  */
7 
8 #pragma once
9 #include "GameCommandList.h"
10 #include "NetStructures/LFG.h"
11 #include "Logging.h"
12 
13 #include "MapEvents.h"
14 #include "MapLink.h"
15 
16 class TeamLooking final : public GameCommand
17 {
18 public:
19  uint32_t m_num = 0;
20  std::vector<LFGMember> m_list;
21  TeamLooking(std::vector<LFGMember> list) : GameCommand(MapEventTypes::evTeamLooking),
22  m_num(list.size()),
23  m_list(list)
24  {
25  }
26  void serializeto(BitStream &bs) const override {
27  bs.StorePackedBits(1,type()-MapEventTypes::evFirstServerToClient); // 25
28 
29  bs.StoreBits(32,m_num); // size of list
30  for(const auto &m : m_list)
31  {
32  bs.StoreString(m.m_name);
33  bs.StoreString(m.m_classname);
34  bs.StoreString(m.m_origin);
35  bs.StoreBits(32,m.m_level);
36  }
37 
38  if(logLFG().isDebugEnabled())
39  dumpLFGList();
40  }
41  void serializefrom(BitStream &src);
42 };
void StoreBits(uint32_t nBits, uint32_t dataBits)
Definition: BitStream.cpp:114
TeamLooking(std::vector< LFGMember > list)
Definition: TeamLooking.h:21
Definition: BitStream.h:30
void StorePackedBits(uint32_t nBits, uint32_t dataBits)
Definition: BitStream.cpp:161
void StoreString(const char *str)
Definition: BitStream.cpp:204
void serializefrom(BitStream &src)
void serializeto(BitStream &bs) const override
Definition: TeamLooking.h:26
uint32_t type() const
Definition: GameCommandList.h:21
Definition: GameCommandList.h:15
std::vector< LFGMember > m_list
Definition: TeamLooking.h:20
Definition: TeamLooking.h:16
uint32_t m_num
Definition: TeamLooking.h:19
void dumpLFGList()
Definition: LFG.cpp:60
Definition: MapEventTypes.h:11