Fixed bug that allowed players that had backed from the kart selection screen to use their device to make selections later on

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@4615 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2010-02-02 01:08:47 +00:00
parent 8dbb31caf9
commit 5bfebb1425
2 changed files with 15 additions and 1 deletions

View File

@ -267,6 +267,8 @@ bool DeviceManager::translateInput( Input::InputType type,
break;
};
//if (*player != NULL) std::cout << "btn " << btnID << " belongs to player " << (*player)->m_id << std::endl;
/*
if (device != NULL)
{

View File

@ -286,7 +286,7 @@ void InputManager::dispatchInput(Input::InputType type, int deviceID, int btnID,
if (action != PA_FIRST)
{
action_found = true;
player = 0;
player = NULL;
}
}
@ -383,6 +383,10 @@ void InputManager::dispatchInput(Input::InputType type, int deviceID, int btnID,
m_timer = 0;
}
// When in master-only mode, we can safely assume that players are set up, contrarly to
// early menus where we accept every input because players are not set-up yet
if (m_master_player_only && player == NULL) return;
// menu input
if (!m_timer_in_use)
{
@ -391,6 +395,7 @@ void InputManager::dispatchInput(Input::InputType type, int deviceID, int btnID,
m_timer_in_use = true;
m_timer = 0.25;
}
int playerID = (player == NULL ? 0 : player->m_id);
// If only the master player can act, and this player is not the master, ignore his input
@ -405,7 +410,9 @@ void InputManager::dispatchInput(Input::InputType type, int deviceID, int btnID,
handleStaticAction( btnID, value );
}
} // input
//-----------------------------------------------------------------------------
void InputManager::setMasterPlayerOnly(bool enabled)
{
#if INPUT_MODE_DEBUG
@ -413,12 +420,17 @@ void InputManager::setMasterPlayerOnly(bool enabled)
#endif
m_master_player_only = enabled;
}
//-----------------------------------------------------------------------------
/** Returns whether only the master player should be allowed to perform changes in menus */
bool InputManager::masterPlayerOnly() const
{
return m_device_manager->getAssignMode() == ASSIGN && m_master_player_only;
}
//-----------------------------------------------------------------------------
/**
* Called on keyboard events [indirectly] by irrLicht
*