mirror of
https://github.com/thunderbrewhq/thunderbrew
synced 2025-12-12 20:35:58 +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);
|
memcpy(this->m_sessionKey, sessionKey, sessionKeyLen);
|
||||||
|
|
||||||
this->m_loginResponse->m_loginResult = LOGIN_OK;
|
|
||||||
|
|
||||||
if (this->m_clientLink->m_surveyID == 0) {
|
if (this->m_clientLink->m_surveyID == 0) {
|
||||||
this->m_loginResponse->m_loginState = LOGIN_STATE_AUTHENTICATED;
|
this->m_loginResponse->UpdateLoginStatus(
|
||||||
|
|
||||||
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(
|
|
||||||
LOGIN_STATE_AUTHENTICATED,
|
LOGIN_STATE_AUTHENTICATED,
|
||||||
LOGIN_OK,
|
LOGIN_OK,
|
||||||
nullptr,
|
nullptr,
|
||||||
stateStr,
|
|
||||||
resultStr,
|
|
||||||
flags
|
flags
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
this->m_loginResponse->m_loginState = LOGIN_STATE_SURVEY;
|
this->m_loginResponse->UpdateLoginStatus(
|
||||||
|
|
||||||
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(
|
|
||||||
LOGIN_STATE_SURVEY,
|
LOGIN_STATE_SURVEY,
|
||||||
LOGIN_OK,
|
LOGIN_OK,
|
||||||
nullptr,
|
nullptr,
|
||||||
stateStr,
|
|
||||||
resultStr,
|
|
||||||
flags
|
flags
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,12 +1,16 @@
|
|||||||
#include "net/login/LoginResponse.hpp"
|
#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_loginState = state;
|
||||||
this->m_loginResult = result;
|
this->m_loginResult = result;
|
||||||
|
|
||||||
// TODO string lookups
|
char stateStr[64];
|
||||||
const char* stateStr = nullptr;
|
SStrCopy(stateStr, Grunt::g_LoginStateStringNames[LOGIN_STATE_AUTHENTICATED], sizeof(stateStr));
|
||||||
const char* resultStr = nullptr;
|
|
||||||
|
|
||||||
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;
|
virtual void LoginServerStatus(LOGIN_STATE state, LOGIN_RESULT result, const char* addrStr, const char* stateStr, const char* resultStr, uint8_t flags) = 0;
|
||||||
|
|
||||||
// Member functions
|
// 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
|
#endif
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user