SEGS  0.6.1-develop [39915b3b]
Super Entity Game Server
PlayerInfo.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 "GameCommand.h"
10 #include "MapEventTypes.h"
11 
12 
13 namespace SEGSEvents
14 {
15 // [[ev_def:type]]
17 {
18 public:
19  // [[ev_def:field]]
20  QString m_info_text;
21  explicit EntityInfoResponse () : GameCommandEvent(MapEventTypes::evEntityInfoResponse)
22  {
23  }
24  EntityInfoResponse (const QString &txt) : GameCommandEvent(MapEventTypes::evEntityInfoResponse),m_info_text(txt)
25  {
26  }
27 
28  void serializeto(BitStream &bs) const override
29  {
30  qCDebug(logMapEvents) << "Info Response: " << m_info_text;
31  bs.StorePackedBits(1, 69);
32  bs.StoreString(m_info_text);
33  }
35 };
36 
37 // [[ev_def:type]]
38 class EntityInfoRequest final : public MapLinkEvent
39 {
40 public:
41  // [[ev_def:field]]
44  {}
45  void serializeto(BitStream &/*bs*/) const override
46  {
47  assert(!"implemented");
48  }
49  void serializefrom(BitStream &bs) override
50  {
51  entity_idx = bs.GetPackedBits(12);
52  }
54 };
55 } // end of SEGSEvents namespace
56 
Definition: PlayerInfo.h:16
void serializeto(BitStream &) const override
Definition: PlayerInfo.h:45
Definition: GameCommand.h:16
EntityInfoRequest()
Definition: PlayerInfo.h:43
EntityInfoResponse()
Definition: PlayerInfo.h:21
void serializefrom(BitStream &bs) override
Definition: PlayerInfo.h:49
int32_t GetPackedBits(uint32_t minbits)
Definition: BitStream.cpp:290
Definition: BitStream.h:34
Definition: LinkLevelEvent.h:13
int entity_idx
Definition: PlayerInfo.h:42
MapEventTypes
Definition: MapEventTypes.h:14
void StorePackedBits(uint32_t nBits, uint32_t dataBits)
Definition: BitStream.cpp:161
void StoreString(const char *str)
Definition: BitStream.cpp:204
void serializeto(BitStream &bs) const override
Definition: PlayerInfo.h:28
#define EVENT_IMPL(name)
Definition: SEGSEvent.h:77
EntityInfoResponse(const QString &txt)
Definition: PlayerInfo.h:24
QString m_info_text
Definition: PlayerInfo.h:20
Definition: PlayerInfo.h:38