Fix pressing escape in kart select screen gonig to overworld

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@11948 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria
2012-11-15 00:09:36 +00:00
parent 392175daea
commit 6325e02b16
3 changed files with 16 additions and 5 deletions

View File

@@ -392,7 +392,7 @@ void CutsceneWorld::enterRaceOverState()
unlock_manager->save();
KartSelectionScreen* s = KartSelectionScreen::getInstance();
s->setMultiplayer(false);
s->setFromOverworld(true);
s->setGoToOverworldNext();
StateManager::get()->pushScreen( s );
}
}

View File

@@ -947,9 +947,10 @@ public:
KartSelectionScreen::KartSelectionScreen() : Screen("karts.stkgui")
{
m_removed_widget = NULL;
m_multiplayer_message = NULL;
m_from_overworld = false;
m_removed_widget = NULL;
m_multiplayer_message = NULL;
m_from_overworld = false;
m_go_to_overworld_next = false;
} // KartSelectionScreen
// ----------------------------------------------------------------------------
@@ -1601,6 +1602,8 @@ void KartSelectionScreen::eventCallback(Widget* widget,
}
else if (name == "back")
{
m_go_to_overworld_next = false; // valid once
if (m_from_overworld)
{
m_from_overworld = false; // valid once
@@ -1638,6 +1641,8 @@ void KartSelectionScreen::setMultiplayer(bool multiplayer)
bool KartSelectionScreen::onEscapePressed()
{
m_go_to_overworld_next = false; // valid once
if (m_from_overworld)
{
m_from_overworld = false; // valid once
@@ -1775,9 +1780,10 @@ void KartSelectionScreen::allPlayersDone()
}
// ---- Go to next screen or return to overworld
if (m_from_overworld)
if (m_from_overworld || m_go_to_overworld_next)
{
m_from_overworld = false; // valid once
m_go_to_overworld_next = false;
OverWorld::enterOverWorld();
}
else

View File

@@ -54,6 +54,9 @@ class KartSelectionScreen : public GUIEngine::Screen,
/** Whether this screen is being visited from overworld or not */
bool m_from_overworld;
bool m_go_to_overworld_next;
KartSelectionScreen();
/** Stores whether any player confirmed their choice; then, some things
@@ -99,6 +102,8 @@ public:
/** \brief Set whether this screen is being visited from overworld or not */
void setFromOverworld(bool from_overworld) { m_from_overworld = from_overworld; }
void setGoToOverworldNext() { m_go_to_overworld_next = true; }
/** \brief Called when a player hits 'fire'/'select' on his device to
* join the game */
bool playerJoin(InputDevice* device, bool firstPlayer);