SEGS  0.6.1-develop [d2cac982]
Super Entity Game Server
InfoMessageCmd.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 "GameCommandList.h"
10 #include "MapEvents.h"
11 
12 class QString;
13 enum class MessageChannel : int;
14 
15 namespace SEGSEvents
16 {
17 
18 // [[ev_def:type]]
20 {
21 public:
22  // [[ev_def:field]]
24  // [[ev_def:field]]
25  QString m_msg;
26 
27 explicit InfoMessageCmd() : GameCommandEvent(evInfoMessageCmd) {}
28  InfoMessageCmd(MessageChannel ch, const QString &msg) : GameCommandEvent(evInfoMessageCmd),
29  m_channel_type(ch),
30  m_msg(msg)
31  {
32  }
33  void serializeto(BitStream &bs) const override
34  {
35  bs.StorePackedBits(1,type()-MapEventTypes::evFirstServerToClient); // packet 15
36  bs.StorePackedBits(2, static_cast<uint8_t>(m_channel_type));
37  bs.StoreString(m_msg);
38  }
40 };
41 
42 } // end of SEGSEvents namespace
Definition: GameCommand.h:16
InfoMessageCmd(MessageChannel ch, const QString &msg)
Definition: InfoMessageCmd.h:28
Definition: BitStream.h:34
Definition: LinkLevelEvent.h:13
QString m_msg
Definition: InfoMessageCmd.h:25
void StorePackedBits(uint32_t nBits, uint32_t dataBits)
Definition: BitStream.cpp:161
MessageChannel
Definition: MessageChannels.h:10
void StoreString(const char *str)
Definition: BitStream.cpp:204
MessageChannel m_channel_type
Definition: InfoMessageCmd.h:23
#define EVENT_IMPL(name)
Definition: SEGSEvent.h:77
Definition: InfoMessageCmd.h:19
InfoMessageCmd()
Definition: InfoMessageCmd.h:27
void serializeto(BitStream &bs) const override
Definition: InfoMessageCmd.h:33