From 73271c8b5e39d01c34064db8a4529e31d36cf0aa Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 17 Oct 2014 22:43:13 +0300 Subject: Add static in loginhandler. --- src/net/ea/loginhandler.cpp | 23 ++++++++++++++--------- src/net/ea/loginhandler.h | 22 +++++++++------------- 2 files changed, 23 insertions(+), 22 deletions(-) (limited to 'src/net/ea') diff --git a/src/net/ea/loginhandler.cpp b/src/net/ea/loginhandler.cpp index 24c9d8e09..57eea9101 100644 --- a/src/net/ea/loginhandler.cpp +++ b/src/net/ea/loginhandler.cpp @@ -42,14 +42,19 @@ namespace Ea { +std::string LoginHandler::mUpdateHost; +Worlds LoginHandler::mWorlds; +Token LoginHandler::mToken; +bool LoginHandler::mVersionResponse = false; +bool LoginHandler::mRegistrationEnabled = true; + LoginHandler::LoginHandler() : - Net::LoginHandler(), - mVersionResponse(false), - mRegistrationEnabled(true), - mUpdateHost(), - mWorlds(), - mToken() + Net::LoginHandler() { + mVersionResponse = false; + mRegistrationEnabled = true; + mUpdateHost.clear(); + mWorlds.clear(); mToken.clear(); } @@ -133,7 +138,7 @@ void LoginHandler::clearWorlds() mWorlds.clear(); } -void LoginHandler::procecessCharPasswordResponse(Net::MessageIn &msg) const +void LoginHandler::processCharPasswordResponse(Net::MessageIn &msg) { // 0: acc not found, 1: success, 2: password mismatch, 3: pass too short const uint8_t errMsg = msg.readUInt8("result code"); @@ -189,7 +194,7 @@ void LoginHandler::processLoginData(Net::MessageIn &msg) { msg.skip(2, "len"); - clearWorlds(); + loginHandler->clearWorlds(); const int worldCount = (msg.getLength() - 47) / 32; @@ -225,7 +230,7 @@ void LoginHandler::processLoginData(Net::MessageIn &msg) client->setState(STATE_WORLD_SELECT); } -void LoginHandler::processLoginError(Net::MessageIn &msg) const +void LoginHandler::processLoginError(Net::MessageIn &msg) { const uint8_t code = msg.readUInt8("error"); logger->log("Login::error code: %u", static_cast(code)); diff --git a/src/net/ea/loginhandler.h b/src/net/ea/loginhandler.h index 6040e72fd..845e11f50 100644 --- a/src/net/ea/loginhandler.h +++ b/src/net/ea/loginhandler.h @@ -87,17 +87,13 @@ class LoginHandler notfinal : public Net::LoginHandler const std::string &password) const override final; - virtual void procecessCharPasswordResponse(Net::MessageIn &msg) const; + static void processCharPasswordResponse(Net::MessageIn &msg); - virtual void processUpdateHost(Net::MessageIn &msg); + static void processUpdateHost(Net::MessageIn &msg); - virtual void processUpdateHost2(Net::MessageIn &msg) const = 0; + static void processLoginData(Net::MessageIn &msg); - virtual void processLoginData(Net::MessageIn &msg); - - virtual void processLoginError(Net::MessageIn &msg) const; - - virtual void processServerVersion(Net::MessageIn &msg) = 0; + static void processLoginError(Net::MessageIn &msg); void loginOrRegister(LoginData *const data) const override final; @@ -108,11 +104,11 @@ class LoginHandler notfinal : public Net::LoginHandler const std::string &password, const std::string &email) const = 0; - bool mVersionResponse; - bool mRegistrationEnabled; - std::string mUpdateHost; - Worlds mWorlds; - Token mToken; + static std::string mUpdateHost; + static Worlds mWorlds; + static Token mToken; + static bool mVersionResponse; + static bool mRegistrationEnabled; }; } // namespace Ea -- cgit v1.2.3-70-g09d2