diff --git a/src/main.cpp b/src/main.cpp index bd48a167c..643f1fae4 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -191,6 +191,7 @@ #include "replay/replay_play.hpp" #include "replay/replay_recorder.hpp" #include "states_screens/story_mode_lobby.hpp" +#include "states_screens/main_menu_screen.hpp" #include "states_screens/state_manager.hpp" #include "states_screens/dialogs/message_dialog.hpp" #include "tracks/track.hpp" @@ -484,6 +485,8 @@ int handleCmdLinePreliminary() UserConfigParams::m_log_errors_to_console=true; if(CommandLine::has("--no-console")) UserConfigParams::m_log_errors_to_console=false; + if(CommandLine::has("--online")) + MainMenuScreen::m_enable_online=true; if(CommandLine::has("--log=nocolor")) { Log::disableColor(); diff --git a/src/states_screens/main_menu_screen.cpp b/src/states_screens/main_menu_screen.cpp index fe6f3dfb3..c25ebf12e 100644 --- a/src/states_screens/main_menu_screen.cpp +++ b/src/states_screens/main_menu_screen.cpp @@ -64,6 +64,8 @@ using namespace Online; DEFINE_SCREEN_SINGLETON( MainMenuScreen ); +bool MainMenuScreen::m_enable_online = false; + // ---------------------------------------------------------------------------- MainMenuScreen::MainMenuScreen() : Screen("main.stkgui") @@ -111,11 +113,10 @@ void MainMenuScreen::init() w->setBadge(LOADING_BADGE); } - IconButtonWidget* online = getWidget("online"); - if(CurrentUser::get()->getID()) - online->setLabel(_("Online")); - else - online->setLabel(_("Login")); + m_online = getWidget("online"); + + if(!m_enable_online) + m_online->setDeactivated(); LabelWidget* w = getWidget("info_addons"); const core::stringw &news_text = NewsManager::get()->getNextNewsMessage(); @@ -141,7 +142,10 @@ void MainMenuScreen::init() // ---------------------------------------------------------------------------- void MainMenuScreen::onUpdate(float delta) + { + m_online->setLabel(CurrentUser::get()->getID() ? _("Online") + : _("Login" ) ); IconButtonWidget* addons_icon = getWidget("addons"); if (addons_icon != NULL) { diff --git a/src/states_screens/main_menu_screen.hpp b/src/states_screens/main_menu_screen.hpp index 20c474c7e..f469a9909 100644 --- a/src/states_screens/main_menu_screen.hpp +++ b/src/states_screens/main_menu_screen.hpp @@ -20,7 +20,8 @@ #include "guiengine/screen.hpp" -namespace GUIEngine { class Widget; class ListWidget; } +namespace GUIEngine { class Widget; class ListWidget; + class IconButtonWidget; } /** * \brief Handles the main menu @@ -31,9 +32,14 @@ class MainMenuScreen : public GUIEngine::Screen, public GUIEngine::ScreenSinglet private: friend class GUIEngine::ScreenSingleton; + /** Keep the widget to avoid looking it up every frame. */ + GUIEngine::IconButtonWidget* m_online; + MainMenuScreen(); public: + /** Temporary disable the online menu while it is being worked at. */ + static bool m_enable_online; virtual void onUpdate(float delta) OVERRIDE;