Fixed continuous warnings message "Ignoring '...', you needed to join earlier to play!"

This is caused by polling the joystick device, and the joystick events triggering
the message. For now the message is not printed if the joystick value is inside
the deadzone value for the joystick (this means that the deadzone is tested at
two locations - once in input manager to avoid the message, once in input_device
- but the latter is not triggered in this case since player is NULL). Not ideal,
so a better solution would be welcome.


git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@6740 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk 2010-11-28 11:39:09 +00:00
parent 53e75bfaa8
commit 7ec971309a

View File

@ -485,7 +485,8 @@ void InputManager::dispatchInput(Input::InputType type, int deviceID, int button
{
GamePadDevice* gp = getDeviceList()->getGamePadFromIrrID(deviceID);
if (gp != NULL)
if (gp != NULL &&
abs(value)>gp->m_deadzone)
{
//I18N: message shown when an input device is used but is not associated to any player
GUIEngine::showMessage(StringUtils::insertValues(_("Ignoring '%s', you needed to join earlier to play!"),
@ -575,11 +576,7 @@ EventPropagation InputManager::input(const SEvent& event)
event.JoystickEvent.Joystick, axis_id, value);
}
// FIXME - AD_NEGATIVE/AD_POSITIVE are probably useless since value contains that info too
// if (value < 0)
dispatchInput(Input::IT_STICKMOTION, event.JoystickEvent.Joystick, axis_id, Input::AD_NEUTRAL, value);
// else
// dispatchInput(Input::IT_STICKMOTION, event.JoystickEvent.Joystick, axis_id, Input::AD_POSITIVE, value);
}
GamePadDevice* gp = getDeviceList()->getGamePadFromIrrID(event.JoystickEvent.Joystick);