1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-28 07:07:45 +00:00
sapphire/src/lobby/ServerLobby.h

61 lines
1 KiB
C
Raw Normal View History

2018-10-28 21:53:21 +01:00
#ifndef _SERVERLOBBY_H_
#define _SERVERLOBBY_H_
2017-08-08 13:53:47 +02:00
#include <map>
#include <memory>
2017-08-08 13:53:47 +02:00
#include <Config/ConfigDef.h>
2017-08-08 13:53:47 +02:00
#include "Forwards.h"
const std::string LOBBY_VERSION = "0.0.5";
namespace Sapphire
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-10-28 21:53:21 +01:00
class ServerLobby
{
2018-10-28 21:53:21 +01:00
friend class LobbyConnection;
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
Sapphire::Common::Config::LobbyConfig& getConfig();
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
Sapphire::Common::Config::LobbyConfig m_config;
2018-10-28 21:53:21 +01:00
};
2017-08-08 13:53:47 +02:00
}
#endif