2018-10-28 21:53:21 +01:00
|
|
|
#ifndef _SERVERLOBBY_H_
|
|
|
|
#define _SERVERLOBBY_H_
|
2017-08-08 13:53:47 +02:00
|
|
|
|
|
|
|
#include <map>
|
2018-10-24 23:39:11 +02:00
|
|
|
#include <memory>
|
2017-08-08 13:53:47 +02:00
|
|
|
|
|
|
|
#include "Forwards.h"
|
|
|
|
|
|
|
|
const std::string LOBBY_VERSION = "0.0.5";
|
|
|
|
|
2018-10-28 21:53:21 +01:00
|
|
|
namespace Core
|
2017-08-08 13:53:47 +02:00
|
|
|
{
|
2018-10-28 21:53:21 +01:00
|
|
|
class LobbySession;
|
|
|
|
class ConfigMgr;
|
2017-08-08 13:53:47 +02:00
|
|
|
|
2018-10-28 21:53:21 +01:00
|
|
|
using LobbySessionMap = std::map< std::string, LobbySessionPtr >;
|
2018-08-29 21:40:59 +02:00
|
|
|
|
2018-10-28 21:53:21 +01:00
|
|
|
class ServerLobby
|
|
|
|
{
|
2018-08-29 21:40:59 +02:00
|
|
|
|
2018-10-28 21:53:21 +01:00
|
|
|
friend class LobbyConnection;
|
2018-08-29 21:40:59 +02:00
|
|
|
|
2018-10-28 21:53:21 +01:00
|
|
|
private:
|
2017-08-08 13:53:47 +02:00
|
|
|
|
2018-10-28 21:53:21 +01:00
|
|
|
LobbySessionMap m_sessionMap;
|
|
|
|
std::string m_configPath;
|
2017-08-08 13:53:47 +02:00
|
|
|
|
2018-10-28 21:53:21 +01:00
|
|
|
uint16_t m_port;
|
|
|
|
std::string m_ip;
|
2017-08-08 13:53:47 +02:00
|
|
|
|
2018-10-28 21:53:21 +01:00
|
|
|
std::shared_ptr< ConfigMgr > m_pConfig;
|
2017-08-08 13:53:47 +02:00
|
|
|
|
2018-10-28 21:53:21 +01:00
|
|
|
public:
|
|
|
|
ServerLobby( const std::string& configPath );
|
2017-09-10 02:24:29 +02:00
|
|
|
|
2018-10-28 21:53:21 +01:00
|
|
|
~ServerLobby( void );
|
2017-08-08 13:53:47 +02:00
|
|
|
|
2018-10-28 21:53:21 +01:00
|
|
|
void run( int32_t argc, char* argv[] );
|
|
|
|
|
|
|
|
bool loadSettings( int32_t argc, char* argv[] );
|
2017-08-08 13:53:47 +02:00
|
|
|
|
2018-10-28 21:53:21 +01:00
|
|
|
void addSession( char* sessionId, LobbySessionPtr pSession )
|
|
|
|
{
|
|
|
|
m_sessionMap[ std::string( sessionId ) ] = pSession;
|
|
|
|
}
|
2017-08-08 13:53:47 +02:00
|
|
|
|
2018-10-28 21:53:21 +01:00
|
|
|
std::shared_ptr< ConfigMgr > getConfig() const;
|
2017-08-08 13:53:47 +02:00
|
|
|
|
2018-10-28 21:53:21 +01:00
|
|
|
LobbySessionPtr getSession( char* sessionId );
|
2017-08-08 13:53:47 +02:00
|
|
|
|
2018-10-28 21:53:21 +01:00
|
|
|
uint32_t m_numConnections;
|
2017-08-08 13:53:47 +02:00
|
|
|
|
2018-10-28 21:53:21 +01:00
|
|
|
};
|
2017-08-08 13:53:47 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|