diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-07-25 17:54:03 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-07-25 17:54:03 +0300 |
commit | 6ea2440a8662c4ffae8f7b6b53e84ddd25d69971 (patch) | |
tree | 2886f69e9cc2209c4d7c346e2d197e6af71662d1 /src | |
parent | dce938023e1247f14597a9a0bacff43f97f9f370 (diff) | |
download | plus-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')
-rw-r--r-- | src/client.cpp | 79 | ||||
-rw-r--r-- | src/client.h | 2 |
2 files changed, 44 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") diff --git a/src/client.h b/src/client.h index a1fea903d..8c36ec888 100644 --- a/src/client.h +++ b/src/client.h @@ -118,6 +118,8 @@ class Client final : public ConfigListener, void stateWorldSelect1(); + void stateGame1(); + ServerInfo mCurrentServer; Game *mGame; |