diff options
author | Jared Adams <jaxad0127@gmail.com> | 2010-05-22 13:01:41 -0600 |
---|---|---|
committer | Jared Adams <jaxad0127@gmail.com> | 2010-05-22 13:01:41 -0600 |
commit | a72030a4e8af2d60ccf574f224070805780e19ca (patch) | |
tree | 09877a6796ffe0219d9ee548636323d32e9b6a07 | |
parent | 2953a3f92c5097bd99ff21f4536fe167a32d90c5 (diff) | |
download | mana-a72030a4e8af2d60ccf574f224070805780e19ca.tar.gz mana-a72030a4e8af2d60ccf574f224070805780e19ca.tar.bz2 mana-a72030a4e8af2d60ccf574f224070805780e19ca.tar.xz mana-a72030a4e8af2d60ccf574f224070805780e19ca.zip |
Fix handling of tmwAthena registration disabled bit
-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; |