diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-08-23 22:00:27 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-08-24 21:08:16 +0300 |
commit | c2a7004213529c403faeb6fdcc374699aa2f53b5 (patch) | |
tree | f5701ef3412923bc0e5e033033bd52960d66acc3 /src | |
parent | e8a4474319aca4a32869fa1ebb8b5ebbd98237f6 (diff) | |
download | plus-c2a7004213529c403faeb6fdcc374699aa2f53b5.tar.gz plus-c2a7004213529c403faeb6fdcc374699aa2f53b5.tar.bz2 plus-c2a7004213529c403faeb6fdcc374699aa2f53b5.tar.xz plus-c2a7004213529c403faeb6fdcc374699aa2f53b5.zip |
improve getState/setState in Client.
Diffstat (limited to 'src')
-rw-r--r-- | src/client.cpp | 6 | ||||
-rw-r--r-- | src/client.h | 8 | ||||
-rw-r--r-- | src/game.cpp | 14 | ||||
-rw-r--r-- | src/gui/changeemaildialog.cpp | 4 | ||||
-rw-r--r-- | src/gui/changepassworddialog.cpp | 4 | ||||
-rw-r--r-- | src/gui/charselectdialog.cpp | 8 | ||||
-rw-r--r-- | src/gui/connectiondialog.cpp | 2 | ||||
-rw-r--r-- | src/gui/logindialog.cpp | 8 | ||||
-rw-r--r-- | src/gui/quitdialog.cpp | 14 | ||||
-rw-r--r-- | src/gui/registerdialog.cpp | 6 | ||||
-rw-r--r-- | src/gui/serverdialog.cpp | 8 | ||||
-rw-r--r-- | src/gui/unregisterdialog.cpp | 4 | ||||
-rw-r--r-- | src/gui/updaterwindow.cpp | 8 | ||||
-rw-r--r-- | src/gui/worldselectdialog.cpp | 6 | ||||
-rw-r--r-- | src/net/ea/charserverhandler.cpp | 6 | ||||
-rw-r--r-- | src/net/ea/gamehandler.cpp | 4 | ||||
-rw-r--r-- | src/net/ea/loginhandler.cpp | 12 | ||||
-rw-r--r-- | src/net/eathena/charserverhandler.cpp | 2 | ||||
-rw-r--r-- | src/net/eathena/gamehandler.cpp | 2 | ||||
-rw-r--r-- | src/net/eathena/generalhandler.cpp | 6 | ||||
-rw-r--r-- | src/net/eathena/loginhandler.cpp | 8 | ||||
-rw-r--r-- | src/net/tmwa/charserverhandler.cpp | 2 | ||||
-rw-r--r-- | src/net/tmwa/gamehandler.cpp | 2 | ||||
-rw-r--r-- | src/net/tmwa/generalhandler.cpp | 6 | ||||
-rw-r--r-- | src/net/tmwa/loginhandler.cpp | 8 |
25 files changed, 79 insertions, 79 deletions
diff --git a/src/client.cpp b/src/client.cpp index 6cb9ac028..ccd2b76c7 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -172,7 +172,7 @@ void ErrorListener::action(const gcn::ActionEvent &event) { if (event.getId() == "yes") openBrowser(Client::getSupportUrl()); - Client::setState(STATE_CHOOSE_SERVER); + client->setState(STATE_CHOOSE_SERVER); } volatile int tick_time; /**< Tick counter */ @@ -251,7 +251,7 @@ class AccountListener final : public gcn::ActionListener public: void action(const gcn::ActionEvent &) { - Client::setState(STATE_CHAR_SELECT); + client->setState(STATE_CHAR_SELECT); } } accountListener; @@ -260,7 +260,7 @@ class LoginListener final : public gcn::ActionListener public: void action(const gcn::ActionEvent &) { - Client::setState(STATE_PRE_LOGIN); + client->setState(STATE_PRE_LOGIN); } } loginListener; diff --git a/src/client.h b/src/client.h index a4d7a288c..73d4ae28b 100644 --- a/src/client.h +++ b/src/client.h @@ -232,11 +232,11 @@ public: int testsExec() const; - static void setState(const State state) - { instance()->mState = state; } + void setState(const State state) + { mState = state; } - static State getState() A_WARN_UNUSED - { return instance()->mState; } + State getState() A_WARN_UNUSED + { return mState; } static const std::string &getPackageDirectory() A_WARN_UNUSED { return instance()->mPackageDir; } diff --git a/src/game.cpp b/src/game.cpp index 80408f836..884034179 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -455,7 +455,7 @@ Game::~Game() AnimatedSprite::setEnableCache(false); del_0(actorSpriteManager) - if (Client::getState() != STATE_CHANGE_MAP) + if (client->getState() != STATE_CHANGE_MAP) del_0(player_node) del_0(commandHandler) del_0(effectManager) @@ -611,10 +611,10 @@ void Game::slowLogic() // Handle network stuff if (!Net::getGameHandler()->isConnected()) { - if (Client::getState() == STATE_CHANGE_MAP) + if (client->getState() == STATE_CHANGE_MAP) return; // Not a problem here - if (Client::getState() != STATE_ERROR) + if (client->getState() != STATE_ERROR) { if (!disconnectedDialog) { @@ -633,14 +633,14 @@ void Game::slowLogic() const Map *const map = viewport->getCurrentMap(); if (map) { - logger->log("state: %d", Client::getState()); + logger->log("state: %d", client->getState()); map->saveExtraLayer(); } } closeDialogs(); Client::setFramerate(config.getIntValue("fpslimit")); mNextAdjustTime = cur_time + adjustDelay; - if (Client::getState() != STATE_ERROR) + if (client->getState() != STATE_ERROR) errorMessage.clear(); } else @@ -899,7 +899,7 @@ void Game::handleActive(const SDL_Event &event) else { // window minimization #ifdef ANDROID - Client::setState(STATE_EXIT); + client->setState(STATE_EXIT); #else Client::setIsMinimized(true); if (player_node && !player_node->getAway()) @@ -988,7 +988,7 @@ void Game::handleInput() #endif // Quit event case SDL_QUIT: - Client::setState(STATE_EXIT); + client->setState(STATE_EXIT); break; #ifdef ANDROID case SDL_KEYBOARDSHOW: diff --git a/src/gui/changeemaildialog.cpp b/src/gui/changeemaildialog.cpp index 3840dece3..3cf519336 100644 --- a/src/gui/changeemaildialog.cpp +++ b/src/gui/changeemaildialog.cpp @@ -115,7 +115,7 @@ void ChangeEmailDialog::action(const gcn::ActionEvent &event) const std::string &eventId = event.getId(); if (eventId == "cancel") { - Client::setState(STATE_CHAR_SELECT); + client->setState(STATE_CHAR_SELECT); } else if (eventId == "change_email") { @@ -175,7 +175,7 @@ void ChangeEmailDialog::action(const gcn::ActionEvent &event) mChangeEmailButton->setEnabled(false); // Set the new email address mLoginData->email = newFirstEmail; - Client::setState(STATE_CHANGEEMAIL_ATTEMPT); + client->setState(STATE_CHANGEEMAIL_ATTEMPT); } } } diff --git a/src/gui/changepassworddialog.cpp b/src/gui/changepassworddialog.cpp index 84b21da8b..c337dccdf 100644 --- a/src/gui/changepassworddialog.cpp +++ b/src/gui/changepassworddialog.cpp @@ -94,7 +94,7 @@ void ChangePasswordDialog::action(const gcn::ActionEvent &event) const std::string &eventId = event.getId(); if (eventId == "cancel") { - Client::setState(STATE_CHAR_SELECT); + client->setState(STATE_CHAR_SELECT); } else if (eventId == "change_password") { @@ -166,7 +166,7 @@ void ChangePasswordDialog::action(const gcn::ActionEvent &event) // Set the new password mLoginData->password = oldPassword; mLoginData->newPassword = newFirstPass; - Client::setState(STATE_CHANGEPASSWORD_ATTEMPT); + client->setState(STATE_CHANGEPASSWORD_ATTEMPT); } } } diff --git a/src/gui/charselectdialog.cpp b/src/gui/charselectdialog.cpp index 8daf1e279..92f1aeba8 100644 --- a/src/gui/charselectdialog.cpp +++ b/src/gui/charselectdialog.cpp @@ -266,16 +266,16 @@ void CharSelectDialog::action(const gcn::ActionEvent &event) } else if (eventId == "change_password") { - Client::setState(STATE_CHANGEPASSWORD); + client->setState(STATE_CHANGEPASSWORD); } else if (eventId == "change_email") { - Client::setState(STATE_CHANGEEMAIL); + client->setState(STATE_CHANGEEMAIL); } else if (eventId == "unregister") { Net::getCharServerHandler()->clear(); - Client::setState(STATE_UNREGISTER); + client->setState(STATE_UNREGISTER); } else if (eventId == "try delete character") { @@ -552,7 +552,7 @@ bool CharSelectDialog::selectByName(const std::string &name, void CharSelectDialog::close() { - Client::setState(STATE_SWITCH_LOGIN); + client->setState(STATE_SWITCH_LOGIN); Window::close(); } diff --git a/src/gui/connectiondialog.cpp b/src/gui/connectiondialog.cpp index f6a80c91e..97894492f 100644 --- a/src/gui/connectiondialog.cpp +++ b/src/gui/connectiondialog.cpp @@ -59,7 +59,7 @@ ConnectionDialog::ConnectionDialog(const std::string &text, void ConnectionDialog::action(const gcn::ActionEvent &) { logger->log1("Cancel pressed"); - Client::setState(mCancelState); + client->setState(mCancelState); } void ConnectionDialog::draw(gcn::Graphics *graphics) diff --git a/src/gui/logindialog.cpp b/src/gui/logindialog.cpp index 458cb15cd..701981008 100644 --- a/src/gui/logindialog.cpp +++ b/src/gui/logindialog.cpp @@ -276,7 +276,7 @@ void LoginDialog::action(const gcn::ActionEvent &event) { prepareUpdate(); mLoginData->registerLogin = false; - Client::setState(STATE_LOGIN_ATTEMPT); + client->setState(STATE_LOGIN_ATTEMPT); } else if (eventId == "server") { @@ -287,7 +287,7 @@ void LoginDialog::action(const gcn::ActionEvent &event) if (Net::getLoginHandler()->isRegistrationEnabled()) { prepareUpdate(); - Client::setState(STATE_REGISTER_PREP); + client->setState(STATE_REGISTER_PREP); } else if (!mLoginData->registerUrl.empty()) { @@ -339,7 +339,7 @@ bool LoginDialog::canSubmit() const { return !mUserField->getText().empty() && !mPassField->getText().empty() && - Client::getState() == STATE_LOGIN; + client->getState() == STATE_LOGIN; } void LoginDialog::prepareUpdate() @@ -408,6 +408,6 @@ void LoginDialog::prepareUpdate() void LoginDialog::close() { - Client::setState(STATE_SWITCH_SERVER); + client->setState(STATE_SWITCH_SERVER); Window::close(); } diff --git a/src/gui/quitdialog.cpp b/src/gui/quitdialog.cpp index cfdfb03c2..894d4ff24 100644 --- a/src/gui/quitdialog.cpp +++ b/src/gui/quitdialog.cpp @@ -77,7 +77,7 @@ QuitDialog::QuitDialog(QuitDialog **const pointerToMe): addKeyListener(this); ContainerPlacer placer = getPlacer(0, 0); - const State state = Client::getState(); + const State state = client->getState(); mNeedForceQuit = (state == STATE_CHOOSE_SERVER || state == STATE_CONNECT_SERVER || state == STATE_LOGIN || state == STATE_PRE_LOGIN || state == STATE_LOGIN_ATTEMPT @@ -162,12 +162,12 @@ void QuitDialog::action(const gcn::ActionEvent &event) if (mForceQuit->isSelected()) { - Client::setState(STATE_FORCE_QUIT); + client->setState(STATE_FORCE_QUIT); } else if (mLogoutQuit->isSelected()) { Game::closeDialogs(); - Client::setState(STATE_EXIT); + client->setState(STATE_EXIT); } else if (mRate && mRate->isSelected()) { @@ -176,23 +176,23 @@ void QuitDialog::action(const gcn::ActionEvent &event) config.setValue("rated", true); if (mNeedForceQuit) { - Client::setState(STATE_FORCE_QUIT); + client->setState(STATE_FORCE_QUIT); } else { Game::closeDialogs(); - Client::setState(STATE_EXIT); + client->setState(STATE_EXIT); } } else if (Net::getGameHandler()->isConnected() && mSwitchAccountServer->isSelected()) { Game::closeDialogs(); - Client::setState(STATE_SWITCH_SERVER); + client->setState(STATE_SWITCH_SERVER); } else if (mSwitchCharacter->isSelected()) { - if (Client::getState() == STATE_GAME) + if (client->getState() == STATE_GAME) { Net::getCharServerHandler()->switchCharacter(); Game::closeDialogs(); diff --git a/src/gui/registerdialog.cpp b/src/gui/registerdialog.cpp index a4de48807..233bf9bf9 100644 --- a/src/gui/registerdialog.cpp +++ b/src/gui/registerdialog.cpp @@ -274,7 +274,7 @@ void RegisterDialog::action(const gcn::ActionEvent &event) mLoginData->email = mEmailField->getText(); mLoginData->registerLogin = true; - Client::setState(STATE_REGISTER_ATTEMPT); + client->setState(STATE_REGISTER_ATTEMPT); } } } @@ -308,11 +308,11 @@ bool RegisterDialog::canSubmit() const return !mUserField->getText().empty() && !mPasswordField->getText().empty() && !mConfirmField->getText().empty() && - Client::getState() == STATE_REGISTER; + client->getState() == STATE_REGISTER; } void RegisterDialog::close() { - Client::setState(STATE_LOGIN); + client->setState(STATE_LOGIN); Window::close(); } diff --git a/src/gui/serverdialog.cpp b/src/gui/serverdialog.cpp index 14f97576a..12ac7420a 100644 --- a/src/gui/serverdialog.cpp +++ b/src/gui/serverdialog.cpp @@ -363,7 +363,7 @@ ServerDialog::~ServerDialog() void ServerDialog::connectToSelectedServer() { - if (Client::getState() == STATE_CONNECT_SERVER) + if (client->getState() == STATE_CONNECT_SERVER) return; const int index = mServersList->getSelected(); @@ -402,7 +402,7 @@ void ServerDialog::connectToSelectedServer() config.setValue("usePersistentIP", mPersistentIPCheckBox->isSelected()); - Client::setState(STATE_CONNECT_SERVER); + client->setState(STATE_CONNECT_SERVER); } void ServerDialog::action(const gcn::ActionEvent &event) @@ -448,7 +448,7 @@ void ServerDialog::keyPressed(gcn::KeyEvent &keyEvent) { case Input::KEY_GUI_CANCEL: keyEvent.consume(); - Client::setState(STATE_EXIT); + client->setState(STATE_EXIT); return; case Input::KEY_GUI_SELECT: @@ -869,6 +869,6 @@ void ServerDialog::close() { if (mDownload) mDownload->cancel(); - Client::setState(STATE_FORCE_QUIT); + client->setState(STATE_FORCE_QUIT); Window::close(); } diff --git a/src/gui/unregisterdialog.cpp b/src/gui/unregisterdialog.cpp index eabf13633..bb727b9ce 100644 --- a/src/gui/unregisterdialog.cpp +++ b/src/gui/unregisterdialog.cpp @@ -103,7 +103,7 @@ void UnRegisterDialog::action(const gcn::ActionEvent &event) const std::string &eventId = event.getId(); if (eventId == "cancel") { - Client::setState(STATE_CHAR_SELECT); + client->setState(STATE_CHAR_SELECT); } else if (eventId == "unregister") { @@ -149,7 +149,7 @@ void UnRegisterDialog::action(const gcn::ActionEvent &event) // No errors detected, unregister the new user. mUnRegisterButton->setEnabled(false); mLoginData->password = password; - Client::setState(STATE_UNREGISTER_ATTEMPT); + client->setState(STATE_UNREGISTER_ATTEMPT); } } } diff --git a/src/gui/updaterwindow.cpp b/src/gui/updaterwindow.cpp index f17621f6f..f41269179 100644 --- a/src/gui/updaterwindow.cpp +++ b/src/gui/updaterwindow.cpp @@ -257,7 +257,7 @@ void UpdaterWindow::enable() mPlayButton->requestFocus(); if (mUpdateType & LoginData::Upd_Close) - Client::setState(STATE_LOAD_DATA); + client->setState(STATE_LOAD_DATA); } void UpdaterWindow::action(const gcn::ActionEvent &event) @@ -276,7 +276,7 @@ void UpdaterWindow::action(const gcn::ActionEvent &event) } else if (eventId == "play") { - Client::setState(STATE_LOAD_DATA); + client->setState(STATE_LOAD_DATA); } } @@ -286,7 +286,7 @@ void UpdaterWindow::keyPressed(gcn::KeyEvent &keyEvent) if (actionId == static_cast<int>(Input::KEY_GUI_CANCEL)) { action(gcn::ActionEvent(nullptr, mCancelButton->getActionEventId())); - Client::setState(STATE_LOGIN); + client->setState(STATE_LOGIN); } else if (actionId == static_cast<int>(Input::KEY_GUI_SELECT) || actionId == static_cast<int>(Input::KEY_GUI_SELECT2)) @@ -465,7 +465,7 @@ int UpdaterWindow::updateProgress(void *ptr, DownloadStatus status, uw->setProgress(progress); - if (Client::getState() != STATE_UPDATE + if (client->getState() != STATE_UPDATE || uw->mDownloadStatus == UPDATE_ERROR) { // If the action was canceled return an error code to stop the mThread diff --git a/src/gui/worldselectdialog.cpp b/src/gui/worldselectdialog.cpp index e8ed35ab2..37dbbc3cf 100644 --- a/src/gui/worldselectdialog.cpp +++ b/src/gui/worldselectdialog.cpp @@ -141,12 +141,12 @@ void WorldSelectDialog::action(const gcn::ActionEvent &event) Net::getLoginHandler()->chooseServer(mWorldList->getSelected()); // Check in case netcode moves us forward - if (Client::getState() == STATE_WORLD_SELECT) - Client::setState(STATE_WORLD_SELECT_ATTEMPT); + if (client->getState() == STATE_WORLD_SELECT) + client->setState(STATE_WORLD_SELECT_ATTEMPT); } else if (eventId == "login") { - Client::setState(STATE_PRE_LOGIN); + client->setState(STATE_PRE_LOGIN); } } diff --git a/src/net/ea/charserverhandler.cpp b/src/net/ea/charserverhandler.cpp index ef47cf99e..81beac26e 100644 --- a/src/net/ea/charserverhandler.cpp +++ b/src/net/ea/charserverhandler.cpp @@ -135,7 +135,7 @@ void CharServerHandler::processCharLoginError(Net::MessageIn &msg) const errorMessage = _("Unknown char-server failure."); break; } - Client::setState(STATE_ERROR); + client->setState(STATE_ERROR); BLOCK_END("CharServerHandler::processCharLoginError") } @@ -261,7 +261,7 @@ void CharServerHandler::processCharMapInfo(Net::MessageIn &msg, if (network) network->disconnect(); - Client::setState(STATE_CONNECT_GAME); + client->setState(STATE_CONNECT_GAME); BLOCK_END("CharServerHandler::processCharMapInfo") } @@ -283,7 +283,7 @@ void CharServerHandler::processChangeMapServer(Net::MessageIn &msg, server.port = msg.readInt16(); network->disconnect(); - Client::setState(STATE_CHANGE_MAP); + client->setState(STATE_CHANGE_MAP); if (player_node) { player_node->setTileCoords(x, y); diff --git a/src/net/ea/gamehandler.cpp b/src/net/ea/gamehandler.cpp index faee4b2d8..df2c4ec47 100644 --- a/src/net/ea/gamehandler.cpp +++ b/src/net/ea/gamehandler.cpp @@ -59,7 +59,7 @@ void GameHandler::processMapLogin(Net::MessageIn &msg) const logger->log("Protocol: Player start position: (%d, %d)," " Direction: %d", x, y, direction); // Switch now or we'll have problems - Client::setState(STATE_GAME); + client->setState(STATE_GAME); if (player_node) player_node->setTileCoords(x, y); } @@ -72,7 +72,7 @@ void GameHandler::processWhoAnswer(Net::MessageIn &msg) const void GameHandler::processCharSwitchResponse(Net::MessageIn &msg) const { if (msg.readInt8()) - Client::setState(STATE_SWITCH_CHARACTER); + client->setState(STATE_SWITCH_CHARACTER); } void GameHandler::processMapQuitResponse(Net::MessageIn &msg) const diff --git a/src/net/ea/loginhandler.cpp b/src/net/ea/loginhandler.cpp index 2632aeb3b..fbe588b1f 100644 --- a/src/net/ea/loginhandler.cpp +++ b/src/net/ea/loginhandler.cpp @@ -61,7 +61,7 @@ bool LoginHandler::isRegistrationEnabled() const void LoginHandler::getRegistrationDetails() const { // Not supported, so move on - Client::setState(STATE_REGISTER); + client->setState(STATE_REGISTER); } void LoginHandler::loginAccount(LoginData *const loginData) const @@ -93,7 +93,7 @@ void LoginHandler::chooseServer(const unsigned int server) const charServer->port = mWorlds[server]->port; } - Client::setState(STATE_UPDATE); + client->setState(STATE_UPDATE); } void LoginHandler::registerAccount(LoginData *const loginData) const @@ -139,7 +139,7 @@ void LoginHandler::procecessCharPasswordResponse(Net::MessageIn &msg) const // Successful pass change if (errMsg == 1) { - Client::setState(STATE_CHANGEPASSWORD_SUCCESS); + client->setState(STATE_CHANGEPASSWORD_SUCCESS); } // pass change failed else @@ -164,7 +164,7 @@ void LoginHandler::procecessCharPasswordResponse(Net::MessageIn &msg) const errorMessage = _("Unknown error."); break; } - Client::setState(STATE_ACCOUNTCHANGE_ERROR); + client->setState(STATE_ACCOUNTCHANGE_ERROR); } } @@ -222,7 +222,7 @@ void LoginHandler::processLoginData(Net::MessageIn &msg) mWorlds.push_back(world); } - Client::setState(STATE_WORLD_SELECT); + client->setState(STATE_WORLD_SELECT); } void LoginHandler::processLoginError(Net::MessageIn &msg) const @@ -291,7 +291,7 @@ void LoginHandler::processLoginError(Net::MessageIn &msg) const errorMessage = _("Unknown error."); break; } - Client::setState(STATE_ERROR); + client->setState(STATE_ERROR); } void LoginHandler::logout() const diff --git a/src/net/eathena/charserverhandler.cpp b/src/net/eathena/charserverhandler.cpp index 1d4928bc9..8c580ce3a 100644 --- a/src/net/eathena/charserverhandler.cpp +++ b/src/net/eathena/charserverhandler.cpp @@ -294,7 +294,7 @@ void CharServerHandler::processCharLogin(Net::MessageIn &msg) } } - Client::setState(STATE_CHAR_SELECT); + client->setState(STATE_CHAR_SELECT); } } // namespace EAthena diff --git a/src/net/eathena/gamehandler.cpp b/src/net/eathena/gamehandler.cpp index cdb3029bc..4b9bcb80f 100644 --- a/src/net/eathena/gamehandler.cpp +++ b/src/net/eathena/gamehandler.cpp @@ -107,7 +107,7 @@ void GameHandler::connect() static_cast<LoginHandler*>(Net::getLoginHandler())->getToken(); - if (Client::getState() == STATE_CONNECT_GAME) + if (client->getState() == STATE_CONNECT_GAME) { // Change the player's ID to the account ID to match what eAthena uses if (player_node) diff --git a/src/net/eathena/generalhandler.cpp b/src/net/eathena/generalhandler.cpp index 029b7fcd4..55b3b644f 100644 --- a/src/net/eathena/generalhandler.cpp +++ b/src/net/eathena/generalhandler.cpp @@ -133,7 +133,7 @@ void GeneralHandler::handleMessage(Net::MessageIn &msg) errorMessage = _("No servers available."); break; case 2: - if (Client::getState() == STATE_GAME) + if (client->getState() == STATE_GAME) { errorMessage = _("Someone else is trying to use this " "account."); @@ -153,7 +153,7 @@ void GeneralHandler::handleMessage(Net::MessageIn &msg) errorMessage = _("Unknown connection error."); break; } - Client::setState(STATE_ERROR); + client->setState(STATE_ERROR); break; } @@ -224,7 +224,7 @@ void GeneralHandler::flushNetwork() else errorMessage = _("Got disconnected from server!"); - Client::setState(STATE_ERROR); + client->setState(STATE_ERROR); } } diff --git a/src/net/eathena/loginhandler.cpp b/src/net/eathena/loginhandler.cpp index 91900b623..1ecfc2a51 100644 --- a/src/net/eathena/loginhandler.cpp +++ b/src/net/eathena/loginhandler.cpp @@ -167,8 +167,8 @@ void LoginHandler::processServerVersion(Net::MessageIn &msg) msg.readInt32(); mRegistrationEnabled = true; serverVersion = 0; - if (Client::getState() != STATE_LOGIN) - Client::setState(STATE_LOGIN); + if (client->getState() != STATE_LOGIN) + client->setState(STATE_LOGIN); // Leave this last mVersionResponse = true; @@ -193,8 +193,8 @@ void LoginHandler::processUpdateHost2(Net::MessageIn &msg) const logger->log("Received update hosts \"%s\" from login server.", updateHost.c_str()); - if (Client::getState() == STATE_PRE_LOGIN) - Client::setState(STATE_LOGIN); + if (client->getState() == STATE_PRE_LOGIN) + client->setState(STATE_LOGIN); } } // namespace EAthena diff --git a/src/net/tmwa/charserverhandler.cpp b/src/net/tmwa/charserverhandler.cpp index c4571969e..6e58f5ee7 100644 --- a/src/net/tmwa/charserverhandler.cpp +++ b/src/net/tmwa/charserverhandler.cpp @@ -347,7 +347,7 @@ void CharServerHandler::processCharLogin(Net::MessageIn &msg) } } - Client::setState(STATE_CHAR_SELECT); + client->setState(STATE_CHAR_SELECT); BLOCK_END("CharServerHandler::processCharLogin") } diff --git a/src/net/tmwa/gamehandler.cpp b/src/net/tmwa/gamehandler.cpp index 62457d718..b066db36b 100644 --- a/src/net/tmwa/gamehandler.cpp +++ b/src/net/tmwa/gamehandler.cpp @@ -103,7 +103,7 @@ void GameHandler::connect() const Token &token = static_cast<LoginHandler*>( Net::getLoginHandler())->getToken(); - if (Client::getState() == STATE_CONNECT_GAME) + if (client->getState() == STATE_CONNECT_GAME) { // Change the player's ID to the account ID to match what eAthena uses if (player_node) diff --git a/src/net/tmwa/generalhandler.cpp b/src/net/tmwa/generalhandler.cpp index ba8f40551..1d92e1eb8 100644 --- a/src/net/tmwa/generalhandler.cpp +++ b/src/net/tmwa/generalhandler.cpp @@ -145,7 +145,7 @@ void GeneralHandler::handleMessage(Net::MessageIn &msg) errorMessage = _("No servers available."); break; case 2: - if (Client::getState() == STATE_GAME) + if (client->getState() == STATE_GAME) { // TRANSLATORS: error message errorMessage = _("Someone else is trying to use this " @@ -170,7 +170,7 @@ void GeneralHandler::handleMessage(Net::MessageIn &msg) errorMessage = _("Unknown connection error."); break; } - Client::setState(STATE_ERROR); + client->setState(STATE_ERROR); break; } @@ -251,7 +251,7 @@ void GeneralHandler::flushNetwork() errorMessage = _("Got disconnected from server!"); } - Client::setState(STATE_ERROR); + client->setState(STATE_ERROR); } BLOCK_END("GeneralHandler::flushNetwork 3") } diff --git a/src/net/tmwa/loginhandler.cpp b/src/net/tmwa/loginhandler.cpp index 9dc9c5447..4f7a35d3b 100644 --- a/src/net/tmwa/loginhandler.cpp +++ b/src/net/tmwa/loginhandler.cpp @@ -208,8 +208,8 @@ void LoginHandler::processServerVersion(Net::MessageIn &msg) logger->log("Server version: %d", serverVersion); if (serverVersion < 5) { - if (Client::getState() != STATE_LOGIN) - Client::setState(STATE_LOGIN); + if (client->getState() != STATE_LOGIN) + client->setState(STATE_LOGIN); } // Leave this last @@ -235,8 +235,8 @@ void LoginHandler::processUpdateHost2(Net::MessageIn &msg) const logger->log("Received update hosts \"%s\" from login server.", updateHost.c_str()); - if (Client::getState() == STATE_PRE_LOGIN) - Client::setState(STATE_LOGIN); + if (client->getState() == STATE_PRE_LOGIN) + client->setState(STATE_LOGIN); } int LoginHandler::supportedOptionalActions() const |