From a3c0254f819c804da55982dea4c8cff90d9dbda8 Mon Sep 17 00:00:00 2001 From: Deve Date: Wed, 14 Mar 2018 20:49:05 +0100 Subject: [PATCH] Better fix for login screen --- src/main.cpp | 8 +++++--- src/states_screens/user_screen.cpp | 9 ++++++++- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 1d8b69ca9..68f75a0fb 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1746,10 +1746,12 @@ int main(int argc, char *argv[] ) // so we immediately start the main menu (unless it was requested // to always show the login screen). Otherwise show the login // screen first. - MainMenuScreen::getInstance()->push(); - - if (!PlayerManager::getCurrentPlayer() || + if(PlayerManager::getCurrentPlayer() && ! UserConfigParams::m_always_show_login_screen) + { + MainMenuScreen::getInstance()->push(); + } + else { UserScreen::getInstance()->push(); // If there is no player, push the RegisterScreen on top of diff --git a/src/states_screens/user_screen.cpp b/src/states_screens/user_screen.cpp index bf1239e45..46d60f78e 100644 --- a/src/states_screens/user_screen.cpp +++ b/src/states_screens/user_screen.cpp @@ -406,7 +406,14 @@ void BaseUserScreen::eventCallback(Widget* widget, */ void BaseUserScreen::closeScreen() { - StateManager::get()->popMenu(); + if (StateManager::get()->getMenuStackSize() > 1) + { + StateManager::get()->popMenu(); + } + else + { + StateManager::get()->resetAndGoToScreen(MainMenuScreen::getInstance()); + } } // closeScreen // ----------------------------------------------------------------------------