Players quitting is now a bit better handled (selections shouldnt be messed up anymore) but hard to test since I only have a keyboard + a gamepad. Folks with lots of gamepads, testing please\!

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/irrlicht@4176 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2009-10-31 00:45:59 +00:00
parent e169cdce88
commit 27c5a59a25

View File

@ -303,6 +303,12 @@ FocusDispatcher* g_dispatcher = NULL;
~PlayerKartWidget() ~PlayerKartWidget()
{ {
if (GUIEngine::g_focus_for_player[m_playerID] == this)
{
unsetFocusForPlayer(m_playerID);
GUIEngine::g_focus_for_player[m_playerID] = NULL;
}
if (playerIDLabel->getIrrlichtElement() != NULL) if (playerIDLabel->getIrrlichtElement() != NULL)
playerIDLabel->getIrrlichtElement()->remove(); playerIDLabel->getIrrlichtElement()->remove();
@ -328,8 +334,14 @@ FocusDispatcher* g_dispatcher = NULL;
assert(false); assert(false);
} }
Widget* focus = GUIEngine::g_focus_for_player[m_playerID];
if (focus != NULL) focus->unsetFocusForPlayer(m_playerID);
GUIEngine::g_focus_for_player[m_playerID] = NULL;
m_playerID = newPlayerID; m_playerID = newPlayerID;
if (focus != NULL) focus->setFocusForPlayer(m_playerID);
//I18N: In kart selection screen (Will read like 'Player 1 (foobartech gamepad)') //I18N: In kart selection screen (Will read like 'Player 1 (foobartech gamepad)')
irr::core::stringw newLabel = StringUtils::insertValues(_("Player %i (%s)"), m_playerID + 1, deviceName.c_str()); irr::core::stringw newLabel = StringUtils::insertValues(_("Player %i (%s)"), m_playerID + 1, deviceName.c_str());
playerIDLabel->setText( newLabel ); playerIDLabel->setText( newLabel );