From a62388a19c18be41d60b6f0971e44cc06447dc1f Mon Sep 17 00:00:00 2001
From: mfranz <mfranz>
Date: Mon, 27 Jun 2005 13:59:48 +0000
Subject: [PATCH] - fix type warnings - use new removeChildren() to remove the
 named js nodes that we don't   need any more (they are now *really* removed,
 not just detached), and - move it into postinit(). (getChildren() returns a
 SGPropertyNode_ptr,   so all nodes are refcounted and, thus, after the last
 sg/props change   no longer removable in that scope ;-)  Maybe we'll need an
 alternative   getChildren() that returns SGPropertyNode* ...

---
 src/Input/input.cxx | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/src/Input/input.cxx b/src/Input/input.cxx
index 618edc75e..76c9a2d19 100644
--- a/src/Input/input.cxx
+++ b/src/Input/input.cxx
@@ -249,7 +249,7 @@ FGInput::doKey (int k, int modifiers, int x, int y)
     if (!b.last_state || b.is_repeatable) {
       const binding_list_t &bindings = _find_key_bindings(k, modifiers);
 
-      for (int i = 0; i < bindings.size(); i++)
+      for (unsigned int i = 0; i < bindings.size(); i++)
         bindings[i]->fire();
       b.last_state = 1;
     }
@@ -260,7 +260,7 @@ FGInput::doKey (int k, int modifiers, int x, int y)
            << " with modifiers " << modifiers);
     if (b.last_state) {
       const binding_list_t &bindings = _find_key_bindings(k, modifiers);
-      for (int i = 0; i < bindings.size(); i++)
+      for (unsigned int i = 0; i < bindings.size(); i++)
         bindings[i]->fire();
       b.last_state = 0;
     }
@@ -484,10 +484,6 @@ FGInput::_init_joystick ()
       js_node->setStringValue("id", name);
     }
   }
-
-  // get rid of unused config nodes
-  for (unsigned int m = 0; m < js_named.size(); m++)
-    js_nodes->removeChild("js-named", js_named[m]->getIndex(), false);
 }
 
 
@@ -496,6 +492,7 @@ FGInput::_postinit_joystick()
 {
   FGNasalSys *nasalsys = (FGNasalSys *)globals->get_subsystem("nasal");
   SGPropertyNode *js_nodes = fgGetNode("/input/joysticks");
+  js_nodes->removeChildren("js-named");
 
   for (int i = 0; i < MAX_JOYSTICKS; i++) {
     SGPropertyNode_ptr js_node = js_nodes->getChild("js", i);