diff options
Diffstat (limited to 'src/net/ea')
-rw-r--r-- | src/net/ea/generalhandler.cpp | 15 | ||||
-rw-r--r-- | src/net/ea/generalhandler.h | 2 | ||||
-rw-r--r-- | src/net/ea/loginhandler.cpp | 11 | ||||
-rw-r--r-- | src/net/ea/loginhandler.h | 3 |
4 files changed, 23 insertions, 8 deletions
diff --git a/src/net/ea/generalhandler.cpp b/src/net/ea/generalhandler.cpp index 692ebec0..8f02d629 100644 --- a/src/net/ea/generalhandler.cpp +++ b/src/net/ea/generalhandler.cpp @@ -60,14 +60,16 @@ #include "utils/gettext.h" +#include <assert.h> #include <list> -Net::GeneralHandler *generalHandler; +Net::GeneralHandler *generalHandler = NULL; namespace EAthena { Token netToken; ServerInfo charServer; ServerInfo mapServer; +Worlds worlds; GeneralHandler::GeneralHandler(): mAdminHandler(new AdminHandler), @@ -86,6 +88,7 @@ GeneralHandler::GeneralHandler(): mSpecialHandler(new SpecialHandler), mTradeHandler(new TradeHandler) { + //assert(false); static const Uint16 _messages[] = { SMSG_CONNECTION_PROBLEM, 0 @@ -172,9 +175,17 @@ void GeneralHandler::load() mNetwork->registerHandler(mPartyHandler.get()); } +void GeneralHandler::reload() +{ + if (mNetwork) + mNetwork->disconnect(); + worlds.clear(); +} + void GeneralHandler::unload() { - mNetwork->clearHandlers(); + if (mNetwork) + mNetwork->clearHandlers(); } void GeneralHandler::flushNetwork() diff --git a/src/net/ea/generalhandler.h b/src/net/ea/generalhandler.h index 099bed0b..b8ea8049 100644 --- a/src/net/ea/generalhandler.h +++ b/src/net/ea/generalhandler.h @@ -40,6 +40,8 @@ class GeneralHandler : public MessageHandler, public Net::GeneralHandler void load(); + void reload(); + void unload(); void flushNetwork(); diff --git a/src/net/ea/loginhandler.cpp b/src/net/ea/loginhandler.cpp index d2e2adc0..de52bfa3 100644 --- a/src/net/ea/loginhandler.cpp +++ b/src/net/ea/loginhandler.cpp @@ -35,13 +35,12 @@ #include "utils/gettext.h" #include "utils/stringutils.h" -Worlds worlds; - Net::LoginHandler *loginHandler; namespace EAthena { extern Token netToken; extern ServerInfo charServer; +extern Worlds worlds; LoginHandler::LoginHandler() { @@ -212,10 +211,14 @@ void LoginHandler::disconnect() void LoginHandler::loginAccount(LoginData *loginData) { - mLoginData = loginData; sendLoginRegister(loginData->username, loginData->password); } +void LoginHandler::logout() +{ + // TODO +} + void LoginHandler::changeEmail(const std::string &email) { // TODO @@ -242,8 +245,6 @@ void LoginHandler::chooseServer(unsigned int server) void LoginHandler::registerAccount(LoginData *loginData) { - mLoginData = loginData; - std::string username = loginData->username; username.append((netToken.sex == GENDER_FEMALE) ? "_F" : "_M"); diff --git a/src/net/ea/loginhandler.h b/src/net/ea/loginhandler.h index 780aa832..c5ce975e 100644 --- a/src/net/ea/loginhandler.h +++ b/src/net/ea/loginhandler.h @@ -51,6 +51,8 @@ class LoginHandler : public MessageHandler, public Net::LoginHandler void loginAccount(LoginData *loginData); + void logout(); + void changeEmail(const std::string &email); void changePassword(const std::string &username, @@ -70,7 +72,6 @@ class LoginHandler : public MessageHandler, public Net::LoginHandler void sendLoginRegister(const std::string &username, const std::string &password); - LoginData *mLoginData; std::string mUpdateHost; }; |