summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-07-25 17:15:26 +0300
committerAndrei Karas <akaras@inbox.ru>2015-07-25 17:15:26 +0300
commitdce938023e1247f14597a9a0bacff43f97f9f370 (patch)
tree4fecde6dcbf6bf92d914fea17a883010751d347b
parenteac7bf3541eea467246d816a76f6b2b6a2e1e18a (diff)
downloadmanaplus-dce938023e1247f14597a9a0bacff43f97f9f370.tar.gz
manaplus-dce938023e1247f14597a9a0bacff43f97f9f370.tar.bz2
manaplus-dce938023e1247f14597a9a0bacff43f97f9f370.tar.xz
manaplus-dce938023e1247f14597a9a0bacff43f97f9f370.zip
Move state handler STATE_WORLD_SELECT into separate function.
-rw-r--r--src/client.cpp14
-rw-r--r--src/client.h2
2 files changed, 13 insertions, 3 deletions
diff --git a/src/client.cpp b/src/client.cpp
index 8358468fc..02626dcd4 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -775,6 +775,15 @@ void Client::stateConnectServer1()
}
}
+void Client::stateWorldSelect1()
+{
+ if (mOldState == STATE_UPDATE)
+ {
+ if (loginHandler->getWorlds().size() < 2)
+ mState = STATE_PRE_LOGIN;
+ }
+}
+
int Client::gameExec()
{
int lastTickTime = tick_time;
@@ -845,10 +854,9 @@ int Client::gameExec()
{
stateConnectServer1();
}
- else if (mState == STATE_WORLD_SELECT && mOldState == STATE_UPDATE)
+ else if (mState == STATE_WORLD_SELECT)
{
- if (loginHandler->getWorlds().size() < 2)
- mState = STATE_PRE_LOGIN;
+ stateWorldSelect1();
}
else if (mOldState == STATE_START ||
(mOldState == STATE_GAME && mState != STATE_GAME))
diff --git a/src/client.h b/src/client.h
index d3edf82e2..a1fea903d 100644
--- a/src/client.h
+++ b/src/client.h
@@ -116,6 +116,8 @@ class Client final : public ConfigListener,
void stateConnectServer1();
+ void stateWorldSelect1();
+
ServerInfo mCurrentServer;
Game *mGame;