Commit ca5b351e authored by scrawl's avatar scrawl

Fix saved joystick bindings being discarded when running without joystick connected

parent 903e59f4
......@@ -78,6 +78,9 @@ namespace ICS
// add bindings
void InputControlSystem::addJoystickAxisBinding(Control* control, int deviceID, int axis, Control::ControlChangingDirection direction)
{
if (std::find(mJoystickIDList.begin(), mJoystickIDList.end(), deviceID) == mJoystickIDList.end())
mJoystickIDList.push_back(deviceID);
ICS_LOG("\tAdding AxisBinder [axis="
+ ToString<int>(axis) + ", deviceID="
+ ToString<int>(deviceID) + ", direction="
......@@ -93,6 +96,9 @@ namespace ICS
void InputControlSystem::addJoystickButtonBinding(Control* control, int deviceID, unsigned int button, Control::ControlChangingDirection direction)
{
if (std::find(mJoystickIDList.begin(), mJoystickIDList.end(), deviceID) == mJoystickIDList.end())
mJoystickIDList.push_back(deviceID); // Hack: add the device to the list so bindings are saved in save() even when joystick is not connected
ICS_LOG("\tAdding JoystickButtonBinder [button="
+ ToString<int>(button) + ", deviceID="
+ ToString<int>(deviceID) + ", direction="
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment