Cleanup some variables
This commit is contained in:
@@ -12,7 +12,7 @@ private:
|
|||||||
std::vector< uint8_t > m_data;
|
std::vector< uint8_t > m_data;
|
||||||
int32_t m_endOfData;
|
int32_t m_endOfData;
|
||||||
|
|
||||||
enum CREATE_REPLY {
|
enum ERROR_CODE {
|
||||||
SUCCESS = 0,
|
SUCCESS = 0,
|
||||||
FATAL_ERROR,
|
FATAL_ERROR,
|
||||||
GENERAL_ERROR,
|
GENERAL_ERROR,
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ private:
|
|||||||
CharacterSlotData m_metaData;
|
CharacterSlotData m_metaData;
|
||||||
std::vector< uint8_t > m_characterData;
|
std::vector< uint8_t > m_characterData;
|
||||||
|
|
||||||
enum CREATE_REPLY {
|
enum ERROR_CODE {
|
||||||
SUCCESS = 0,
|
SUCCESS = 0,
|
||||||
FATAL_ERROR,
|
FATAL_ERROR,
|
||||||
GENERAL_ERROR,
|
GENERAL_ERROR,
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ private:
|
|||||||
std::wstring m_sessionId;
|
std::wstring m_sessionId;
|
||||||
std::wstring m_gameName;
|
std::wstring m_gameName;
|
||||||
|
|
||||||
enum CREATE_REPLY {
|
enum ERROR_CODE {
|
||||||
SUCCESS = 0,
|
SUCCESS = 0,
|
||||||
FATAL_ERROR,
|
FATAL_ERROR,
|
||||||
GENERAL_ERROR,
|
GENERAL_ERROR,
|
||||||
|
|||||||
@@ -25,14 +25,14 @@ sptr_generic_response RequestCreatePrivateGame_RTA::ProcessRequest( sptr_socket
|
|||||||
if( user == nullptr )
|
if( user == nullptr )
|
||||||
{
|
{
|
||||||
Log::Error( "User not found! [{}]", m_sessionId );
|
Log::Error( "User not found! [{}]", m_sessionId );
|
||||||
return std::make_shared< ResultCreatePrivateGame_RTA >( this, CREATE_REPLY::FATAL_ERROR, "", 0 );
|
return std::make_shared< ResultCreatePrivateGame_RTA >( this, FATAL_ERROR, "", 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
auto result = GameSessionManager::Get().CreateGameSession_RTA( user, L"", m_gameName, {}, true);
|
auto result = GameSessionManager::Get().CreateGameSession_RTA( user, L"", m_gameName, {}, true);
|
||||||
if( !result )
|
if( !result )
|
||||||
{
|
{
|
||||||
Log::Error( "RequestCreatePrivateGame2::ProcessRequest() - Failed to create private game session!" );
|
Log::Error( "RequestCreatePrivateGame2::ProcessRequest() - Failed to create private game session!" );
|
||||||
return std::make_shared< ResultCreatePrivateGame_RTA >( this, CREATE_REPLY::GENERAL_ERROR, "", 0 );
|
return std::make_shared< ResultCreatePrivateGame_RTA >( this, GENERAL_ERROR, "", 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
user->m_localAddr = m_localAddr;
|
user->m_localAddr = m_localAddr;
|
||||||
@@ -40,7 +40,7 @@ sptr_generic_response RequestCreatePrivateGame_RTA::ProcessRequest( sptr_socket
|
|||||||
|
|
||||||
Log::Info( "[{}] Create Private Game: {}", m_sessionId, m_gameName );
|
Log::Info( "[{}] Create Private Game: {}", m_sessionId, m_gameName );
|
||||||
|
|
||||||
return std::make_shared< ResultCreatePrivateGame_RTA >( this, CREATE_REPLY::SUCCESS, Config::service_ip, Config::discovery_port );
|
return std::make_shared< ResultCreatePrivateGame_RTA >( this, SUCCESS, Config::service_ip, Config::discovery_port );
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultCreatePrivateGame_RTA::ResultCreatePrivateGame_RTA( GenericRequest *request, int32_t reply, std::string discoveryIp, int32_t discoveryPort ) : GenericResponse( *request )
|
ResultCreatePrivateGame_RTA::ResultCreatePrivateGame_RTA( GenericRequest *request, int32_t reply, std::string discoveryIp, int32_t discoveryPort ) : GenericResponse( *request )
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ private:
|
|||||||
std::string m_localAddr;
|
std::string m_localAddr;
|
||||||
int32_t m_localPort;
|
int32_t m_localPort;
|
||||||
|
|
||||||
enum CREATE_REPLY {
|
enum ERROR_CODE {
|
||||||
SUCCESS = 0,
|
SUCCESS = 0,
|
||||||
FATAL_ERROR,
|
FATAL_ERROR,
|
||||||
GENERAL_ERROR,
|
GENERAL_ERROR,
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ private:
|
|||||||
int32_t m_minimumLevel;
|
int32_t m_minimumLevel;
|
||||||
int32_t m_maximumLevel;
|
int32_t m_maximumLevel;
|
||||||
|
|
||||||
enum CREATE_REPLY {
|
enum ERROR_CODE {
|
||||||
SUCCESS = 0,
|
SUCCESS = 0,
|
||||||
FATAL_ERROR,
|
FATAL_ERROR,
|
||||||
GENERAL_ERROR,
|
GENERAL_ERROR,
|
||||||
|
|||||||
@@ -77,14 +77,14 @@ sptr_generic_response RequestCreatePublicGame_RTA::ProcessRequest( sptr_socket s
|
|||||||
if( user == nullptr )
|
if( user == nullptr )
|
||||||
{
|
{
|
||||||
Log::Error( "User not found! [{}]", m_sessionId );
|
Log::Error( "User not found! [{}]", m_sessionId );
|
||||||
return std::make_shared< ResultCreatePublicGame_RTA >( this, CREATE_REPLY::GENERAL_ERROR, "", 0 );
|
return std::make_shared< ResultCreatePublicGame_RTA >( this, GENERAL_ERROR, "", 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
auto result = GameSessionManager::Get().CreateGameSession_RTA( user, m_gameInfo, m_gameName, m_attributes, false );
|
auto result = GameSessionManager::Get().CreateGameSession_RTA( user, m_gameInfo, m_gameName, m_attributes, false );
|
||||||
if( !result )
|
if( !result )
|
||||||
{
|
{
|
||||||
Log::Error( "RequestCreatePublicGame::ProcessRequest() - Failed to create public game session!" );
|
Log::Error( "RequestCreatePublicGame::ProcessRequest() - Failed to create public game session!" );
|
||||||
return std::make_shared< ResultCreatePublicGame_RTA >( this, CREATE_REPLY::GENERAL_ERROR, "", 0 );
|
return std::make_shared< ResultCreatePublicGame_RTA >( this, GENERAL_ERROR, "", 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
user->m_localAddr = m_localAddr;
|
user->m_localAddr = m_localAddr;
|
||||||
@@ -92,7 +92,7 @@ sptr_generic_response RequestCreatePublicGame_RTA::ProcessRequest( sptr_socket s
|
|||||||
|
|
||||||
Log::Info( "[{}] Create Public Game: {}", user->m_username, m_gameInfo );
|
Log::Info( "[{}] Create Public Game: {}", user->m_username, m_gameInfo );
|
||||||
|
|
||||||
return std::make_shared< ResultCreatePublicGame_RTA >( this, CREATE_REPLY::SUCCESS, Config::service_ip, Config::discovery_port );
|
return std::make_shared< ResultCreatePublicGame_RTA >( this, SUCCESS, Config::service_ip, Config::discovery_port );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Result
|
// Result
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ private:
|
|||||||
|
|
||||||
std::array< int8_t, 5 > m_attributes;
|
std::array< int8_t, 5 > m_attributes;
|
||||||
|
|
||||||
enum CREATE_REPLY {
|
enum ERROR_CODE {
|
||||||
SUCCESS = 0,
|
SUCCESS = 0,
|
||||||
FATAL_ERROR,
|
FATAL_ERROR,
|
||||||
GENERAL_ERROR,
|
GENERAL_ERROR,
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ class RequestGetNetCharacterData_RTA : public GenericRequest
|
|||||||
private:
|
private:
|
||||||
int32_t m_characterId;
|
int32_t m_characterId;
|
||||||
|
|
||||||
enum CREATE_REPLY {
|
enum ERROR_CODE {
|
||||||
SUCCESS = 0,
|
SUCCESS = 0,
|
||||||
FATAL_ERROR,
|
FATAL_ERROR,
|
||||||
GENERAL_ERROR,
|
GENERAL_ERROR,
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
class RequestGetNetCharacterList_RTA : public GenericRequest
|
class RequestGetNetCharacterList_RTA : public GenericRequest
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
enum CREATE_REPLY {
|
enum ERROR_CODE {
|
||||||
SUCCESS = 0,
|
SUCCESS = 0,
|
||||||
FATAL_ERROR,
|
FATAL_ERROR,
|
||||||
GENERAL_ERROR,
|
GENERAL_ERROR,
|
||||||
|
|||||||
@@ -35,16 +35,7 @@ sptr_generic_response RequestSaveCharacter_RTA::ProcessRequest( sptr_socket sock
|
|||||||
auto user = userManager.FindUserBySocket( socket );
|
auto user = userManager.FindUserBySocket( socket );
|
||||||
if( user == nullptr || user->m_accountId == -1 )
|
if( user == nullptr || user->m_accountId == -1 )
|
||||||
{
|
{
|
||||||
// Try to recover the user through session records.
|
return std::make_shared< ResultSaveCharacter_RTA >( this, FATAL_ERROR );
|
||||||
user = UserManager::Get().RecoverUserBySession( m_sessionId, socket );
|
|
||||||
|
|
||||||
if( user == nullptr )
|
|
||||||
{
|
|
||||||
Log::Error( "Failed to recover user by session ID: {}", m_sessionId );
|
|
||||||
return std::make_shared< ResultSaveCharacter_RTA >( this, FATAL_ERROR );
|
|
||||||
}
|
|
||||||
|
|
||||||
Log::Debug( "Recovered user by session ID: {}", m_sessionId );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sptr_user targetUser = user;
|
sptr_user targetUser = user;
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ private:
|
|||||||
CharacterSlotData m_metaData;
|
CharacterSlotData m_metaData;
|
||||||
std::vector< uint8_t > m_characterData;
|
std::vector< uint8_t > m_characterData;
|
||||||
|
|
||||||
enum CREATE_REPLY {
|
enum ERROR_CODE {
|
||||||
SUCCESS = 0,
|
SUCCESS = 0,
|
||||||
FATAL_ERROR,
|
FATAL_ERROR,
|
||||||
GENERAL_ERROR,
|
GENERAL_ERROR,
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ class RequestStartGame : public GenericRequest
|
|||||||
private:
|
private:
|
||||||
std::vector< uint8_t > m_data;
|
std::vector< uint8_t > m_data;
|
||||||
|
|
||||||
enum CREATE_REPLY {
|
enum ERROR_CODE {
|
||||||
SUCCESS = 0,
|
SUCCESS = 0,
|
||||||
FATAL_ERROR,
|
FATAL_ERROR,
|
||||||
GENERAL_ERROR,
|
GENERAL_ERROR,
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ private:
|
|||||||
std::wstring m_sessionId;
|
std::wstring m_sessionId;
|
||||||
std::wstring m_ownerSessionId;
|
std::wstring m_ownerSessionId;
|
||||||
|
|
||||||
enum CREATE_REPLY {
|
enum ERROR_CODE {
|
||||||
SUCCESS = 0,
|
SUCCESS = 0,
|
||||||
FATAL_ERROR,
|
FATAL_ERROR,
|
||||||
GENERAL_ERROR,
|
GENERAL_ERROR,
|
||||||
|
|||||||
Reference in New Issue
Block a user