Unselect a kart when a player elaves (doesn't work for player 0, but anyway I'm not sure how we'll handle the 'host' quitting)
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/irrlicht@3942 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
1cf6eac79a
commit
4b19a059f0
@ -111,6 +111,11 @@ void Widget::setFocusForPlayer(const int playerID)
|
||||
m_player_focus[playerID] = true;
|
||||
GUIEngine::g_focus_for_player[playerID] = this;
|
||||
}
|
||||
|
||||
void Widget::unsetFocusForPlayer(const int playerID)
|
||||
{
|
||||
m_player_focus[playerID] = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* \param playerID ID of the player you want to set/unset focus for, starting from 0
|
||||
|
@ -251,6 +251,8 @@ namespace GUIEngine
|
||||
*/
|
||||
bool isFocusedForPlayer(const int playerID);
|
||||
|
||||
void unsetFocusForPlayer(const int playerID);
|
||||
|
||||
/**
|
||||
* Call to resize/move the widget. Not all widgets can resize gracefully.
|
||||
*/
|
||||
|
@ -525,6 +525,13 @@ bool playerQuit(ActivePlayer* player)
|
||||
// between g_player_karts and the active player array
|
||||
assert( g_player_karts.size() == StateManager::get()->activePlayerCount() );
|
||||
|
||||
// unset selection of this player
|
||||
if (GUIEngine::g_focus_for_player[playerID] != NULL)
|
||||
{
|
||||
GUIEngine::g_focus_for_player[playerID]->unsetFocusForPlayer(playerID);
|
||||
}
|
||||
GUIEngine::g_focus_for_player[playerID] = NULL;
|
||||
|
||||
removedWidget = g_player_karts.remove(playerID);
|
||||
StateManager::get()->removeActivePlayer(playerID);
|
||||
renumberKarts();
|
||||
|
Loading…
Reference in New Issue
Block a user