diff options
-rw-r--r-- | src/gui/login.cpp | 3 | ||||
-rw-r--r-- | src/net/tmwa/loginhandler.cpp | 13 | ||||
-rw-r--r-- | src/net/tmwa/loginhandler.h | 1 |
3 files changed, 9 insertions, 8 deletions
diff --git a/src/gui/login.cpp b/src/gui/login.cpp index bfad5c32..b243fd04 100644 --- a/src/gui/login.cpp +++ b/src/gui/login.cpp @@ -91,7 +91,8 @@ LoginDialog::LoginDialog(LoginData *loginData): mPassField->requestFocus(); mLoginButton->setEnabled(canSubmit()); - mRegisterButton->setEnabled(Net::getLoginHandler()->isRegistrationEnabled()); + mRegisterButton->setEnabled(Net::getLoginHandler() + ->isRegistrationEnabled()); } LoginDialog::~LoginDialog() diff --git a/src/net/tmwa/loginhandler.cpp b/src/net/tmwa/loginhandler.cpp index 7d973ba3..e58acb4d 100644 --- a/src/net/tmwa/loginhandler.cpp +++ b/src/net/tmwa/loginhandler.cpp @@ -42,6 +42,7 @@ namespace TmwAthena { extern ServerInfo charServer; LoginHandler::LoginHandler(): + mVersionResponse(false), mRegistrationEnabled(true) { static const Uint16 _messages[] = { @@ -187,6 +188,7 @@ void LoginHandler::handleMessage(Net::MessageIn &msg) case SMSG_SERVER_VERSION_RESPONSE: { // TODO: verify these! + msg.readInt8(); // -1 msg.readInt8(); // T msg.readInt8(); // M @@ -194,13 +196,10 @@ void LoginHandler::handleMessage(Net::MessageIn &msg) unsigned int options = msg.readInt32(); - if (options & 1) - { - // Registeration not allowed - mRegistrationEnabled = false; - } + mRegistrationEnabled = (options & 1); - //state = STATE_LOGIN; + // Leave this last + mVersionResponse = true; } break; } @@ -214,7 +213,7 @@ void LoginHandler::connect() bool LoginHandler::isConnected() { - return mNetwork->isConnected(); + return mVersionResponse && mNetwork->isConnected(); } void LoginHandler::disconnect() diff --git a/src/net/tmwa/loginhandler.h b/src/net/tmwa/loginhandler.h index 455c75f1..8f6ea321 100644 --- a/src/net/tmwa/loginhandler.h +++ b/src/net/tmwa/loginhandler.h @@ -83,6 +83,7 @@ class LoginHandler : public MessageHandler, public Net::LoginHandler void sendLoginRegister(const std::string &username, const std::string &password); + bool mVersionResponse; bool mRegistrationEnabled; std::string mUpdateHost; Worlds mWorlds; |