SEGS  0.6.1-develop [d2cac982]
Super Entity Game Server
TeamOffer.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 "MapEventTypes.h"
10 #include "GameCommand.h"
11 #include "BitStream.h"
12 
13 enum class TeamOfferType : uint8_t
14 {
15  NoMission = 0,
16  WithMission = 1,
17  LeaveMission = 2,
18 };
19 
20 namespace SEGSEvents
21 {
22 
23 // [[ev_def:type]]
24 class TeamOffer final : public GameCommandEvent
25 {
26 public:
27  // [[ev_def:field]]
28  uint32_t m_db_id;
29  // [[ev_def:field]]
30  QString m_name;
31  // [[ev_def:field]]
33 
34 explicit TeamOffer() : GameCommandEvent(MapEventTypes::evTeamOffer) {}
35  TeamOffer(uint32_t &db_id, QString &name, TeamOfferType &type) : GameCommandEvent(MapEventTypes::evTeamOffer),
36  m_db_id(db_id),
37  m_name(name),
38  m_offer_type(type)
39  {
40  }
41  void serializeto(BitStream &bs) const override
42  {
43  bs.StorePackedBits(1,type()-MapEventTypes::evFirstServerToClient); // packet 24
44  bs.StoreBits(32, m_db_id); // team offeree db_id
45  bs.StoreString(m_name); // team offerer name
46  bs.StoreBits(2, uint8_t(m_offer_type)); // team with mission?
47  }
49 };
50 
51 } // end of SEGSEvents namespace
52 
TeamOfferType
Definition: TeamOffer.h:13
void StoreBits(uint32_t nBits, uint32_t dataBits)
Definition: BitStream.cpp:114
uint32_t m_db_id
Definition: TeamOffer.h:28
Definition: TeamOffer.h:24
Definition: GameCommand.h:16
TeamOffer(uint32_t &db_id, QString &name, TeamOfferType &type)
Definition: TeamOffer.h:35
Definition: BitStream.h:34
Definition: LinkLevelEvent.h:13
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
#define EVENT_IMPL(name)
Definition: SEGSEvent.h:77
void serializeto(BitStream &bs) const override
Definition: TeamOffer.h:41
TeamOffer()
Definition: TeamOffer.h:34
TeamOfferType m_offer_type
Definition: TeamOffer.h:32
QString m_name
Definition: TeamOffer.h:30