From cc5500b642f1cc5e16a44213c9b7423f8210ec66 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 25 Jul 2015 16:51:44 +0300 Subject: Move state handler STATE_CONNECT_GAME into separate function. --- src/client.cpp | 11 ++++++++--- src/client.h | 2 ++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/client.cpp b/src/client.cpp index 5bd3bd163..598c95cc0 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -697,6 +697,12 @@ int Client::testsExec() top->add(var); +void Client::stateConnectGame1() +{ + if (gameHandler->isConnected()) + loginHandler->disconnect(); +} + int Client::gameExec() { int lastTickTime = tick_time; @@ -759,10 +765,9 @@ int Client::gameExec() BLOCK_END("~Client::SDL_framerateDelay") BLOCK_START("Client::gameExec 6") - if (mState == STATE_CONNECT_GAME && - gameHandler->isConnected()) + if (mState == STATE_CONNECT_GAME) { - loginHandler->disconnect(); + stateConnectGame1(); } else if (mState == STATE_CONNECT_SERVER && mOldState == STATE_CHOOSE_SERVER) diff --git a/src/client.h b/src/client.h index 880a11fb7..84329f54a 100644 --- a/src/client.h +++ b/src/client.h @@ -112,6 +112,8 @@ class Client final : public ConfigListener, static void logVars(); + void stateConnectGame1(); + ServerInfo mCurrentServer; Game *mGame; -- cgit v1.2.3-70-g09d2