Fix player parameter being NULL in input module when starting game with keyboard/mouse but playing with gamepad

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@11135 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria
2012-04-19 01:23:48 +00:00
parent 0f42344fc9
commit ea908cb76f

View File

@@ -326,20 +326,23 @@ InputDevice *DeviceManager::mapGamepadInput( Input::InputType type,
if (gPad != NULL)
{
if (gPad->processAndMapInput(type, btnID, value, mode, gPad->getPlayer(), action))
StateManager::ActivePlayer* thePlayer = NULL;
if (m_single_player != NULL)
{
if (m_single_player != NULL)
{
*player = m_single_player;
}
else if (m_assign_mode == NO_ASSIGN) // Don't set the player in NO_ASSIGN mode
{
*player = NULL;
}
else
{
*player = gPad->m_player;
}
thePlayer = m_single_player;
}
else if (m_assign_mode == NO_ASSIGN) // Don't set the player in NO_ASSIGN mode
{
thePlayer = NULL;
}
else
{
thePlayer = gPad->getPlayer();
}
if (gPad->processAndMapInput(type, btnID, value, mode, thePlayer, action))
{
*player = thePlayer;
}
else gPad = NULL; // If no bind was found, return NULL
}