]> git.mxchange.org Git - flightgear.git/blobdiff - src/Input/input.cxx
Added static port system and a new altimeter model connected to it.
[flightgear.git] / src / Input / input.cxx
index bb350b4320cdc48204d1a0daff27e88126184f87..93cad1dbadd33cdc0675bbe208d27b01402ce390 100644 (file)
@@ -403,12 +403,12 @@ FGInput::doMouseMotion (int x, int y)
                                // so we can play with it.
   if (x != m.x) {
     int delta = x - m.x;
-    for (int i = 0; i < mode.x_bindings[modifiers].size(); i++)
+    for (unsigned int i = 0; i < mode.x_bindings[modifiers].size(); i++)
       mode.x_bindings[modifiers][i]->fire(double(delta), double(xsize));
   }
   if (y != m.y) {
     int delta = y - m.y;
-    for (int i = 0; i < mode.y_bindings[modifiers].size(); i++)
+    for (unsigned int i = 0; i < mode.y_bindings[modifiers].size(); i++)
       mode.y_bindings[modifiers][i]->fire(double(delta), double(ysize));
   }
 
@@ -483,18 +483,26 @@ FGInput::_init_joystick ()
       continue;
     } else {
 #ifdef FG_PLIB_JOYSTICK_GETNAME
+      bool found_js = false;
       const char * name = js->getName();
-      std::cout << "Looking for bindings for joystick \""
-               << name << '"' << std::endl;
+      SG_LOG(SG_INPUT, SG_INFO, "Looking for bindings for joystick \""
+            << name << '"');
       vector<SGPropertyNode_ptr> nodes = js_nodes->getChildren("js-named");
-      for (int i = 0; i < nodes.size(); i++) {
+      for (unsigned int i = 0; i < nodes.size(); i++) {
        SGPropertyNode_ptr node = nodes[i];
-       std::cout << "  Trying \"" << node->getStringValue("name") << '"' << std::endl;
-       if (!strcmp(node->getStringValue("name"), name)) {
-         std::cout << "  Found bindings" << std::endl;
-         js_node = node;
-         break;
-       }
+        vector<SGPropertyNode_ptr> name_nodes = node->getChildren("name");
+        for (unsigned int j = 0; j < name_nodes.size(); j++) {
+            const char * js_name = name_nodes[j]->getStringValue();
+            SG_LOG(SG_INPUT, SG_INFO, "  Trying \"" << js_name << '"');
+            if (!strcmp(js_name, name)) {
+                SG_LOG(SG_INPUT, SG_INFO, "  Found bindings");
+                js_node = node;
+                found_js = true;
+                break;
+            }
+        }
+        if (found_js)
+            break;
       }
 #endif
     }
@@ -968,10 +976,10 @@ FGInput::mouse_mode::~mouse_mode ()
 ////////////////////////////////////////////////////////////////////////
 
 FGInput::mouse::mouse ()
-  : nModes(1),
-    current_mode(0),
-    x(-1),
+  : x(-1),
     y(-1),
+    nModes(1),
+    current_mode(0),
     modes(0)
 {
 }