SEGS  0.6.1-develop [3e741b81]
Super Entity Game Server
InteractWithEntity.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 #include "Logging.h"
12 #include "BitStream.h"
13 
14 namespace SEGSEvents
15 {
16 // [[ev_def:type]]
17 class InteractWithEntity final : public MapLinkEvent
18 {
19 public:
20  // [[ev_def:field]]
21  int32_t m_srv_idx = 0;
22  InteractWithEntity() : MapLinkEvent(MapEventTypes::evInteractWithEntity) {}
23  void serializeto(BitStream &bs) const override
24  {
25  bs.StorePackedBits(1, type() - MapEventTypes::evConsoleCommand); // 7
26  bs.StorePackedBits(12, m_srv_idx);
27  }
28  void serializefrom(BitStream &src) override
29  {
30  m_srv_idx = src.GetPackedBits(12);
31  }
33 };
34 } // end of SEGSEvents namespace
35 
Definition: InteractWithEntity.h:17
int32_t GetPackedBits(uint32_t minbits)
Definition: BitStream.cpp:290
Definition: BitStream.h:34
Definition: LinkLevelEvent.h:13
MapEventTypes
Definition: MapEventTypes.h:14
InteractWithEntity()
Definition: InteractWithEntity.h:22
void StorePackedBits(uint32_t nBits, uint32_t dataBits)
Definition: BitStream.cpp:161
void serializeto(BitStream &bs) const override
Definition: InteractWithEntity.h:23
int32_t m_srv_idx
Definition: InteractWithEntity.h:21
uint32_t type() const
Definition: SEGSEvent.h:66
#define EVENT_IMPL(name)
Definition: SEGSEvent.h:77
EventSrc * src() const
Definition: SEGSEvent.h:65
void serializefrom(BitStream &src) override
Definition: InteractWithEntity.h:28