Emergency 20 Dokumentation  4.2.0
MatchmakingTypes.h
Go to the documentation of this file.
1 // Copyright (C) 2012-2018 Promotion Software GmbH
2 
3 
4 //[-------------------------------------------------------]
5 //[ Header guard ]
6 //[-------------------------------------------------------]
7 #pragma once
8 
9 
10 //[-------------------------------------------------------]
11 //[ Includes ]
12 //[-------------------------------------------------------]
13 #include "em5/Export.h"
14 
18 
19 #include <boost/algorithm/string.hpp>
20 
21 
22 //[-------------------------------------------------------]
23 //[ Namespace ]
24 //[-------------------------------------------------------]
25 namespace em5
26 {
27  namespace multiplayer
28  {
29 
30 
31  //[-------------------------------------------------------]
32  //[ Global definitions ]
33  //[-------------------------------------------------------]
35  {
39  };
40 
41  enum GameMode
42  {
45  };
46 
47  struct HostEntry : public qsf::Object
48  {
49  // If changing this struct, make sure to update the CAMP metaclass registration as well
50  bool hasPassword;
51  std::string sessionName;
59  std::string proxyHostname;
61 
62  // Internal
63  std::string hostname;
65  std::string ipv6_address;
66 
67  // Pure internal do not serialize it
68  std::vector<std::string> ipv6_adressList;
69 
70  inline HostEntry() :
71  hasPassword(false),
72  maximumPlayerCount(qsf::getUninitialized<uint32>()),
73  currentPlayerCount(qsf::getUninitialized<uint32>()),
74  globalMapAssetId(qsf::getUninitialized<qsf::GlobalAssetId>()),
75  gameMode(qsf::getUninitialized<GameMode>()),
76  duration(qsf::getUninitialized<uint32>()),
77  playerSeparation(true),
78  proxySessionId(qsf::getUninitialized<uint64>()),
79  proxyPort(qsf::getUninitialized<uint16>()),
80  port(qsf::getUninitialized<uint16>())
81  {
82  // Nothing to do in here
83  }
84 
85  inline HostEntry(const HostEntry& x)
86  {
87  operator=(x);
88  }
89 
90  inline HostEntry& operator=(const HostEntry& x)
91  {
92  hasPassword = x.hasPassword;
93  sessionName = x.sessionName;
94  maximumPlayerCount = x.maximumPlayerCount;
95  currentPlayerCount = x.currentPlayerCount;
96  globalMapAssetId = x.globalMapAssetId;
97  gameMode = x.gameMode;
98  duration = x.duration;
99  playerSeparation = x.playerSeparation;
100  proxySessionId = x.proxySessionId;
101  proxyHostname = x.proxyHostname;
102  proxyPort = x.proxyPort;
103  hostname = x.hostname;
104  port = x.port;
105  ipv6_address = x.ipv6_address;
106 
108  return *this;
109  }
110 
111  inline void splitIPv6Addresses()
112  {
113  ipv6_adressList.clear();
114  if (!ipv6_address.empty())
115  {
116  boost::split(ipv6_adressList, ipv6_address, boost::is_any_of(","));
117  }
118  }
119 
120 
121  //[-------------------------------------------------------]
122  //[ CAMP reflection system ]
123  //[-------------------------------------------------------]
124  QSF_CAMP_RTTI() // Only adds the virtual method "campClassId()", nothing more
125 
126 
127  };
128 
129 
130 //[-------------------------------------------------------]
131 //[ Namespace ]
132 //[-------------------------------------------------------]
133  } // multiplayer
134 } // em5
135 
136 
137 //[-------------------------------------------------------]
138 //[ CAMP reflection system ]
139 //[-------------------------------------------------------]
141 QSF_CAMP_TYPE(em5::multiplayer::GameMode)
142 QSF_CAMP_TYPE(em5::multiplayer::HostEntry)
Definition: ActionPriority.h:13
Object base class.
Definition: Object.h:68
HostEntry(const HostEntry &x)
Definition: MatchmakingTypes.h:85
HostEntry & operator=(const HostEntry &x)
Definition: MatchmakingTypes.h:90
unsigned int uint32
Definition: PlatformTypes.h:181
Definition: MatchmakingTypes.h:37
std::string proxyHostname
The hostname of the multiplayer proxy to which the host is connected to.
Definition: MatchmakingTypes.h:59
RegisterHostStatus
< Connected to CAMP
Definition: MatchmakingTypes.h:34
Definition: MatchmakingTypes.h:44
uint16 proxyPort
The port of the multiplayer proxy to which the host is connected to.
Definition: MatchmakingTypes.h:60
void splitIPv6Addresses()
Definition: MatchmakingTypes.h:111
uint64_t uint64
Definition: PlatformTypes.h:184
#define QSF_CAMP_TYPE(type)
See "CAMP_TYPE" for details.
Definition: CampClass.h:87
std::string hostname
Definition: MatchmakingTypes.h:63
GameMode
< Connected to CAMP
Definition: MatchmakingTypes.h:41
Definition: PickupPersonByParamedicAction.h:21
uint16 port
Definition: MatchmakingTypes.h:64
bool hasPassword
"true" is the game session is password protected, "false" otherwise
Definition: MatchmakingTypes.h:50
Definition: MatchmakingTypes.h:43
#define QSF_CAMP_RTTI()
Only adds the virtual method "campClassId()", nothing more.
Definition: CampClass.h:75
std::vector< std::string > ipv6_adressList
Definition: MatchmakingTypes.h:68
T getUninitialized()
Definition: GetUninitialized.h:38
std::string ipv6_address
Definition: MatchmakingTypes.h:65
uint32 maximumPlayerCount
Maximum number of players in this game session.
Definition: MatchmakingTypes.h:52
unsigned short uint16
Definition: PlatformTypes.h:178
Definition: MatchmakingTypes.h:38
GameMode gameMode
Game mode that will be played in this game session.
Definition: MatchmakingTypes.h:55
HostEntry()
Definition: MatchmakingTypes.h:70
uint32 currentPlayerCount
Current number of connected players in this game session.
Definition: MatchmakingTypes.h:53
std::string sessionName
The name of the game session.
Definition: MatchmakingTypes.h:51
bool playerSeparation
If set, players can't influence each other (referring to AI)
Definition: MatchmakingTypes.h:57
qsf::GlobalAssetId globalMapAssetId
Global asset ID of the map the game session will be played on.
Definition: MatchmakingTypes.h:54
uint32 duration
Duration of the game session in minutes.
Definition: MatchmakingTypes.h:56
uint64 GlobalAssetId
Definition: AssetSystemTypes.h:28
uint64 proxySessionId
Holds the proxy session id when the host is connected to a multiplayer proxy and has created a sessio...
Definition: MatchmakingTypes.h:58
Definition: MatchmakingTypes.h:47
Definition: MatchmakingTypes.h:36