From: James Turner Date: Sat, 29 Jan 2011 16:05:02 +0000 (+0000) Subject: Andreas Gaeb: make input (joystick) re-init work. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=2ea7f87ae1a73f8a493ee201d29ebd3a388b8baa;p=flightgear.git Andreas Gaeb: make input (joystick) re-init work. --- diff --git a/src/Input/FGJoystickInput.cxx b/src/Input/FGJoystickInput.cxx index 349782d5b..17f1f3557 100644 --- a/src/Input/FGJoystickInput.cxx +++ b/src/Input/FGJoystickInput.cxx @@ -119,6 +119,14 @@ void FGJoystickInput::init() } } +void FGJoystickInput::reinit() { + SG_LOG(SG_INPUT, SG_DEBUG, "Re-Initializing joystick bindings"); + SGPropertyNode * js_nodes = fgGetNode("/input/joysticks", true); + js_nodes->removeChildren("js", false); + FGJoystickInput::init(); + FGJoystickInput::postinit(); +} + void FGJoystickInput::postinit() { FGNasalSys *nasalsys = (FGNasalSys *)globals->get_subsystem("nasal"); diff --git a/src/Input/FGJoystickInput.hxx b/src/Input/FGJoystickInput.hxx index ef1530ec0..039401e29 100644 --- a/src/Input/FGJoystickInput.hxx +++ b/src/Input/FGJoystickInput.hxx @@ -44,6 +44,7 @@ public: virtual void init(); virtual void postinit(); + virtual void reinit(); virtual void update( double dt ); static const int MAX_JOYSTICKS = 10;