mirror of
https://github.com/thunderbrewhq/thunderbrew
synced 2025-04-16 10:04:42 +03:00
feat(net): use LoginResponse::UpdateLoginStatus to adjust states in GruntLogin::LogonResult
This commit is contained in:
parent
5355b75768
commit
153b25ede9
@ -166,40 +166,18 @@ void GruntLogin::LogonResult(Grunt::Result result, const uint8_t* sessionKey, ui
|
||||
}
|
||||
memcpy(this->m_sessionKey, sessionKey, sessionKeyLen);
|
||||
|
||||
this->m_loginResponse->m_loginResult = LOGIN_OK;
|
||||
|
||||
if (this->m_clientLink->m_surveyID == 0) {
|
||||
this->m_loginResponse->m_loginState = LOGIN_STATE_AUTHENTICATED;
|
||||
|
||||
char stateStr[64];
|
||||
SStrCopy(stateStr, Grunt::g_LoginStateStringNames[LOGIN_STATE_AUTHENTICATED], sizeof(stateStr));
|
||||
|
||||
char resultStr[64];
|
||||
SStrCopy(resultStr, Grunt::g_LoginResultStringNames[LOGIN_OK], sizeof(resultStr));
|
||||
|
||||
this->m_loginResponse->LoginServerStatus(
|
||||
this->m_loginResponse->UpdateLoginStatus(
|
||||
LOGIN_STATE_AUTHENTICATED,
|
||||
LOGIN_OK,
|
||||
nullptr,
|
||||
stateStr,
|
||||
resultStr,
|
||||
flags
|
||||
);
|
||||
} else {
|
||||
this->m_loginResponse->m_loginState = LOGIN_STATE_SURVEY;
|
||||
|
||||
char stateStr[64];
|
||||
SStrCopy(stateStr, Grunt::g_LoginStateStringNames[LOGIN_STATE_SURVEY], sizeof(stateStr));
|
||||
|
||||
char resultStr[64];
|
||||
SStrCopy(resultStr, Grunt::g_LoginResultStringNames[LOGIN_OK], sizeof(resultStr));
|
||||
|
||||
this->m_loginResponse->LoginServerStatus(
|
||||
this->m_loginResponse->UpdateLoginStatus(
|
||||
LOGIN_STATE_SURVEY,
|
||||
LOGIN_OK,
|
||||
nullptr,
|
||||
stateStr,
|
||||
resultStr,
|
||||
flags
|
||||
);
|
||||
}
|
||||
|
@ -1,12 +1,16 @@
|
||||
#include "net/login/LoginResponse.hpp"
|
||||
#include "net/grunt/Grunt.hpp"
|
||||
#include <storm/String.hpp>
|
||||
|
||||
void LoginResponse::UpdateLoginStatus(LOGIN_STATE state, LOGIN_RESULT result, const char* a4, uint16_t a5) {
|
||||
void LoginResponse::UpdateLoginStatus(LOGIN_STATE state, LOGIN_RESULT result, const char* addrStr, uint16_t flags) {
|
||||
this->m_loginState = state;
|
||||
this->m_loginResult = result;
|
||||
|
||||
// TODO string lookups
|
||||
const char* stateStr = nullptr;
|
||||
const char* resultStr = nullptr;
|
||||
char stateStr[64];
|
||||
SStrCopy(stateStr, Grunt::g_LoginStateStringNames[LOGIN_STATE_AUTHENTICATED], sizeof(stateStr));
|
||||
|
||||
this->LoginServerStatus(state, result, a4, stateStr, resultStr, a5);
|
||||
char resultStr[64];
|
||||
SStrCopy(resultStr, Grunt::g_LoginResultStringNames[LOGIN_OK], sizeof(resultStr));
|
||||
|
||||
this->LoginServerStatus(state, result, addrStr, stateStr, resultStr, flags);
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ class LoginResponse {
|
||||
virtual void LoginServerStatus(LOGIN_STATE state, LOGIN_RESULT result, const char* addrStr, const char* stateStr, const char* resultStr, uint8_t flags) = 0;
|
||||
|
||||
// Member functions
|
||||
void UpdateLoginStatus(LOGIN_STATE state, LOGIN_RESULT result, const char* a4, uint16_t a5);
|
||||
void UpdateLoginStatus(LOGIN_STATE state, LOGIN_RESULT result, const char* addrStr, uint16_t flags);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user