Add Client Type for CON/RTA distinction.
This commit is contained in:
7
Game/Constant.hpp
Normal file
7
Game/Constant.hpp
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
enum class RealmClientType {
|
||||||
|
UNKNOWN = 0,
|
||||||
|
CHAMPIONS_OF_NORRATH = 1,
|
||||||
|
RETURN_TO_ARMS = 2,
|
||||||
|
};
|
||||||
@@ -4,10 +4,13 @@ RealmUser::RealmUser()
|
|||||||
{
|
{
|
||||||
sock = nullptr;
|
sock = nullptr;
|
||||||
|
|
||||||
|
m_clientType = RealmClientType::UNKNOWN;
|
||||||
|
|
||||||
m_sessionId = L"";
|
m_sessionId = L"";
|
||||||
|
|
||||||
m_localAddr = "";
|
m_localAddr = "";
|
||||||
m_discoveryAddr = "";
|
m_discoveryAddr = "";
|
||||||
|
m_discoveryPort = 0;
|
||||||
|
|
||||||
m_isHost = false;
|
m_isHost = false;
|
||||||
m_gameId = 0;
|
m_gameId = 0;
|
||||||
@@ -21,10 +24,13 @@ RealmUser::~RealmUser()
|
|||||||
sock.reset();
|
sock.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_clientType = RealmClientType::UNKNOWN;
|
||||||
|
|
||||||
m_sessionId = L"";
|
m_sessionId = L"";
|
||||||
|
|
||||||
m_localAddr = "";
|
m_localAddr = "";
|
||||||
m_discoveryAddr = "";
|
m_discoveryAddr = "";
|
||||||
|
m_discoveryPort = 0;
|
||||||
|
|
||||||
m_isHost = false;
|
m_isHost = false;
|
||||||
m_gameId = 0;
|
m_gameId = 0;
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ public:
|
|||||||
public:
|
public:
|
||||||
sptr_socket sock; // For Realm Lobby
|
sptr_socket sock; // For Realm Lobby
|
||||||
|
|
||||||
|
RealmClientType m_clientType;
|
||||||
|
|
||||||
std::wstring m_sessionId; // Unique Session ID for the user (Generated at login)
|
std::wstring m_sessionId; // Unique Session ID for the user (Generated at login)
|
||||||
|
|
||||||
bool m_isHost; // True if this user is the host of a realm
|
bool m_isHost; // True if this user is the host of a realm
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ std::wstring RealmUserManager::GenerateSessionId()
|
|||||||
return sessionId;
|
return sessionId;
|
||||||
}
|
}
|
||||||
|
|
||||||
sptr_user RealmUserManager::CreateUser( sptr_socket socket )
|
sptr_user RealmUserManager::CreateUser( sptr_socket socket, RealmClientType clientType )
|
||||||
{
|
{
|
||||||
Log::Debug( "ClientManager::CreateUser() - Created new user" );
|
Log::Debug( "ClientManager::CreateUser() - Created new user" );
|
||||||
|
|
||||||
@@ -30,6 +30,7 @@ sptr_user RealmUserManager::CreateUser( sptr_socket socket )
|
|||||||
|
|
||||||
user->m_sessionId = GenerateSessionId();
|
user->m_sessionId = GenerateSessionId();
|
||||||
user->sock = socket;
|
user->sock = socket;
|
||||||
|
user->m_clientType = clientType;
|
||||||
|
|
||||||
m_users.push_back( user );
|
m_users.push_back( user );
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ public:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
static std::wstring GenerateSessionId();
|
static std::wstring GenerateSessionId();
|
||||||
sptr_user CreateUser( sptr_socket socket );
|
sptr_user CreateUser( sptr_socket socket, RealmClientType clientType );
|
||||||
void RemoveUser( sptr_user user );
|
void RemoveUser( sptr_user user );
|
||||||
void RemoveUser( const std::wstring &sessionId );
|
void RemoveUser( const std::wstring &sessionId );
|
||||||
void RemoveUser( const sptr_socket socket );
|
void RemoveUser( const sptr_socket socket );
|
||||||
|
|||||||
Reference in New Issue
Block a user