summaryrefslogtreecommitdiff
path: root/src/client.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-07-25 17:54:03 +0300
committerAndrei Karas <akaras@inbox.ru>2015-07-25 17:54:03 +0300
commit6ea2440a8662c4ffae8f7b6b53e84ddd25d69971 (patch)
tree2886f69e9cc2209c4d7c346e2d197e6af71662d1 /src/client.cpp
parentdce938023e1247f14597a9a0bacff43f97f9f370 (diff)
downloadplus-6ea2440a8662c4ffae8f7b6b53e84ddd25d69971.tar.gz
plus-6ea2440a8662c4ffae8f7b6b53e84ddd25d69971.tar.bz2
plus-6ea2440a8662c4ffae8f7b6b53e84ddd25d69971.tar.xz
plus-6ea2440a8662c4ffae8f7b6b53e84ddd25d69971.zip
Move state handler STATE_GAME into separate function.
Diffstat (limited to 'src/client.cpp')
-rw-r--r--src/client.cpp79
1 files changed, 42 insertions, 37 deletions
diff --git a/src/client.cpp b/src/client.cpp
index 02626dcd4..f5fba647e 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -784,6 +784,47 @@ void Client::stateWorldSelect1()
}
}
+void Client::stateGame1()
+{
+ if (!gui)
+ return;
+
+ BasicContainer2 *const top = static_cast<BasicContainer2*>(
+ gui->getTop());
+
+ if (!top)
+ return;
+
+ CREATEWIDGETV(desktop, Desktop, nullptr);
+ top->add(desktop);
+ int x = top->getWidth() - mButtonPadding;
+ ADDBUTTON(mSetupButton, new Button(desktop,
+ // TRANSLATORS: setup tab quick button
+ _("Setup"), "Setup", this))
+ ADDBUTTON(mPerfomanceButton, new Button(desktop,
+ // TRANSLATORS: perfoamance tab quick button
+ _("Performance"), "Perfomance", this))
+ ADDBUTTON(mVideoButton, new Button(desktop,
+ // TRANSLATORS: video tab quick button
+ _("Video"), "Video", this))
+ ADDBUTTON(mThemesButton, new Button(desktop,
+ // TRANSLATORS: theme tab quick button
+ _("Theme"), "Themes", this))
+ ADDBUTTON(mAboutButton, new Button(desktop,
+ // TRANSLATORS: theme tab quick button
+ _("About"), "about", this))
+ ADDBUTTON(mHelpButton, new Button(desktop,
+ // TRANSLATORS: theme tab quick button
+ _("Help"), "help", this))
+#ifdef ANDROID
+ ADDBUTTON(mCloseButton, new Button(desktop,
+ // TRANSLATORS: close quick button
+ _("Close"), "close", this))
+#endif
+ desktop->setSize(mainGraphics->getWidth(),
+ mainGraphics->getHeight());
+}
+
int Client::gameExec()
{
int lastTickTime = tick_time;
@@ -861,43 +902,7 @@ int Client::gameExec()
else if (mOldState == STATE_START ||
(mOldState == STATE_GAME && mState != STATE_GAME))
{
- if (!gui)
- break;
-
- BasicContainer2 *const top = static_cast<BasicContainer2*>(
- gui->getTop());
-
- if (!top)
- break;
-
- CREATEWIDGETV(desktop, Desktop, nullptr);
- top->add(desktop);
- int x = top->getWidth() - mButtonPadding;
- ADDBUTTON(mSetupButton, new Button(desktop,
- // TRANSLATORS: setup tab quick button
- _("Setup"), "Setup", this))
- ADDBUTTON(mPerfomanceButton, new Button(desktop,
- // TRANSLATORS: perfoamance tab quick button
- _("Performance"), "Perfomance", this))
- ADDBUTTON(mVideoButton, new Button(desktop,
- // TRANSLATORS: video tab quick button
- _("Video"), "Video", this))
- ADDBUTTON(mThemesButton, new Button(desktop,
- // TRANSLATORS: theme tab quick button
- _("Theme"), "Themes", this))
- ADDBUTTON(mAboutButton, new Button(desktop,
- // TRANSLATORS: theme tab quick button
- _("About"), "about", this))
- ADDBUTTON(mHelpButton, new Button(desktop,
- // TRANSLATORS: theme tab quick button
- _("Help"), "help", this))
-#ifdef ANDROID
- ADDBUTTON(mCloseButton, new Button(desktop,
- // TRANSLATORS: close quick button
- _("Close"), "close", this))
-#endif
- desktop->setSize(mainGraphics->getWidth(),
- mainGraphics->getHeight());
+ stateGame1();
}
BLOCK_END("Client::gameExec 6")