Fixed various bugs in menu not showing up.

This commit is contained in:
hiker 2014-05-16 08:24:15 +10:00
parent 0459c33f66
commit 6650827784
3 changed files with 20 additions and 18 deletions

View File

@ -1,3 +1,4 @@
// //
// SuperTuxKart - a fun racing game with go-kart // SuperTuxKart - a fun racing game with go-kart
// Copyright (C) 2004-2013 Steve Baker <sjbaker1@airmail.net> // Copyright (C) 2004-2013 Steve Baker <sjbaker1@airmail.net>
@ -1286,6 +1287,12 @@ int main(int argc, char *argv[] )
if(!UserConfigParams::m_no_start_screen) if(!UserConfigParams::m_no_start_screen)
{ {
// If there is a current player, it was saved in the config file,
// so we immediately start the main menu. Otherwise show the login
// screen first.
if(PlayerManager::getCurrentPlayer())
StateManager::get()->pushScreen(MainMenuScreen::getInstance());
else
StateManager::get()->pushScreen(UserScreen::getInstance()); StateManager::get()->pushScreen(UserScreen::getInstance());
#ifdef ENABLE_WIIUSE #ifdef ENABLE_WIIUSE
// Show a dialog to allow connection of wiimotes. */ // Show a dialog to allow connection of wiimotes. */

View File

@ -193,6 +193,14 @@ void BaseUserScreen::makeEntryFieldsVisible(bool online)
m_password_tb->setVisible(online); m_password_tb->setVisible(online);
} // makeEntryFieldsVisible } // makeEntryFieldsVisible
// ----------------------------------------------------------------------------
/** Make sure that a current player is defined when escape is pressed.
*/
bool BaseUserScreen::onEscapePressed()
{
return Screen::onEscapePressed();
} // onEscapePressed
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
/** Called when the user selects anything on the screen. /** Called when the user selects anything on the screen.
*/ */
@ -460,21 +468,6 @@ void BaseUserScreen::onDialogClose()
} // onDialogClose } // onDialogClose
// ============================================================================
/** If there already is a player (i.e. default player is saved), no need to
* show this dialog, go directly to the main menu screen.
*/
void UserScreen::init()
{
PlayerProfile *player = PlayerManager::getCurrentPlayer();
if (player)
{
StateManager::get()->resetAndGoToScreen(MainMenuScreen::getInstance());
return;
}
BaseUserScreen::init();
} // init
// ============================================================================ // ============================================================================
/** In the tab version, make sure the right tab is selected. /** In the tab version, make sure the right tab is selected.
*/ */
@ -494,7 +487,7 @@ void TabbedUserScreen::init()
*/ */
void TabbedUserScreen::eventCallback(GUIEngine::Widget* widget, void TabbedUserScreen::eventCallback(GUIEngine::Widget* widget,
const std::string& name, const std::string& name,
const int playerID) const int player_id)
{ {
if (name == "options_choice") if (name == "options_choice")
{ {
@ -509,5 +502,7 @@ void TabbedUserScreen::eventCallback(GUIEngine::Widget* widget,
assert(s); assert(s);
StateManager::get()->replaceTopMostScreen(s); StateManager::get()->replaceTopMostScreen(s);
} }
else
BaseUserScreen::eventCallback(widget, name, player_id);
} // eventCallback } // eventCallback

View File

@ -95,6 +95,7 @@ public:
/** \brief implement optional callback from parent class GUIEngine::Screen */ /** \brief implement optional callback from parent class GUIEngine::Screen */
virtual void unloaded(); virtual void unloaded();
virtual bool onEscapePressed();
void loginSuccessful(); void loginSuccessful();
void loginError(const irr::core::stringw &error_message); void loginError(const irr::core::stringw &error_message);
@ -111,7 +112,6 @@ private:
{}; {};
public: public:
friend class GUIEngine::ScreenSingleton<UserScreen>; friend class GUIEngine::ScreenSingleton<UserScreen>;
virtual void init();
}; // class UserScreenTabed }; // class UserScreenTabed
// ============================================================================ // ============================================================================