SEGS  0.6.1-develop [39915b3b]
Super Entity Game Server
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 - 2019 SEGS Team (see AUTHORS.md)
5  * This software is licensed under the terms of the 3-clause BSD License. See LICENSE.md for details.
6  */
7 
8 #pragma once
9 #include "GameData/LFG.h"
10 #include "MapEventTypes.h"
11 #include "GameCommand.h"
12 #include "BitStream.h"
13 #include "Logging.h"
14 
15 namespace SEGSEvents
16 {
17 // [[ev_def:type]]
18 class TeamLooking final : public GameCommandEvent
19 {
20 public:
21  // [[ev_def:field]]
22  uint32_t m_num = 0;
23  // [[ev_def:field]]
24  std::vector<LFGMember> m_list;
25  explicit TeamLooking() : GameCommandEvent(MapEventTypes::evTeamLooking) {}
26  TeamLooking(const std::vector<LFGMember> &list) : GameCommandEvent(MapEventTypes::evTeamLooking),
27  m_num(list.size()),
28  m_list(list)
29  {
30  }
31  void serializeto(BitStream &bs) const override {
32  bs.StorePackedBits(1,type()-MapEventTypes::evFirstServerToClient); // 25
33 
34  bs.StoreBits(32,m_num); // size of list
35  for(const auto &m : m_list)
36  {
37  bs.StoreString(m.m_name);
38  bs.StoreString(m.m_classname);
39  bs.StoreString(m.m_origin);
40  bs.StoreBits(32,m.m_level);
41  }
42 
43  if(logLFG().isDebugEnabled())
44  dumpLFGList();
45  }
47 };
48 } // end of SEGSEvents namespace
49 
void StoreBits(uint32_t nBits, uint32_t dataBits)
Definition: BitStream.cpp:114
Definition: GameCommand.h:16
Definition: TeamLooking.h:18
Definition: BitStream.h:34
Definition: LinkLevelEvent.h:13
uint32_t m_num
Definition: TeamLooking.h:22
std::vector< LFGMember > m_list
Definition: TeamLooking.h:24
MapEventTypes
Definition: MapEventTypes.h:14
void StorePackedBits(uint32_t nBits, uint32_t dataBits)
Definition: BitStream.cpp:161
void dumpLFGList()
Definition: LFG.cpp:55
TeamLooking(const std::vector< LFGMember > &list)
Definition: TeamLooking.h:26
void StoreString(const char *str)
Definition: BitStream.cpp:204
void serializeto(BitStream &bs) const override
Definition: TeamLooking.h:31
TeamLooking()
Definition: TeamLooking.h:25
uint32_t type() const
Definition: SEGSEvent.h:66
#define EVENT_IMPL(name)
Definition: SEGSEvent.h:77