-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix string view in game world auth #4360
Fix string view in game world auth #4360
Conversation
No need for most of these changes; just changing the return type from |
i tried it your way but i failed, i don't know why but i got an empty string after escaping gameworldAuthentication method(int onRecvFirstMessage method), before adding the string to the pair the string had a valid value |
This reverts commit 09520e9.
updated, issue with @ranisalt approach was std::tie and characterName variable, characterName was string_view not std::string |
I just changed std::tie to std::pair on protocolgame.cpp (L472) and it worked 😕 std::tie(accountId, characterName) = ... std::pair(accountId, characterName) = ... |
I would try with
then
Did it compile or did it work? I think that's creating a new pair with |
you're right... it doesn't override previous values for Ignore my previous comment 👍 |
To be honest, reading the character name would just prevent a hopelessly broken client from not being able to log in, because by default the Tibia client and OTClient send the name exactly as the login server responds. We can skip that code and return solely the account ID, the code gets much simpler. Along these lines: uint32_t accountId = IOLoginData::gameworldAuthentication(accountName, password, characterName, token, tokenTime);
if (accountId == 0) {
disconnectClient("Account name or password is not correct.");
return;
}
g_dispatcher.addTask([=, thisPtr = getThis(), characterName = std::string{characterName}]() {
thisPtr->login(characterName, accountId, operatingSystem);
}); Alternatively, we can instead return the character ID and not the name, and then What do you think? |
characterName is string_view, is string_view moveable? I don't think so... but i can be wrong |
Right, it is not, so keep |
Fix string_view pointing to non-existent string
Pull Request Prelude
Issues addressed:
#4359