]> git.mxchange.org Git - flightgear.git/blobdiff - src/Input/FGMouseInput.cxx
Fixed minor memory leak on joystick reload.
[flightgear.git] / src / Input / FGMouseInput.cxx
index 5d3f7ae2ab3a8722d24a0149fd7336d455e4ec81..8ab430653589579b8556edc0fbe7c034a4c0ad8a 100644 (file)
@@ -117,7 +117,7 @@ void FGMouseInput::init()
       m.mode_node->setIntValue(0);
     }
     for (j = 0; j < MAX_MOUSE_BUTTONS; j++) {
-      buf.clear();
+      buf.seekp(ios_base::beg);
       buf << "/devices/status/mice/mouse["<< i << "]/button[" << j << "]";
       m.mouse_button_nodes[j] = fgGetNode(buf.str().c_str(), true);
       m.mouse_button_nodes[j]->setBoolValue(false);
@@ -150,7 +150,7 @@ void FGMouseInput::init()
       m.modes[j].buttons = new FGButton[MAX_MOUSE_BUTTONS];
       std::ostringstream buf;
       for (k = 0; k < MAX_MOUSE_BUTTONS; k++) {
-        buf.clear();
+        buf.seekp(ios_base::beg);
         buf << "mouse button " << k;
         SG_LOG(SG_INPUT, SG_DEBUG, "Initializing mouse button " << k);
         m.modes[j].buttons[k].init( mode_node->getChild("button", k), buf.str(), module );
@@ -332,7 +332,7 @@ void FGMouseInput::doMouseMotion (int x, int y)
   }
   if (y != m.y) {
     int delta = y - m.y;
-    yAccelNode->setIntValue( delta );
+    yAccelNode->setIntValue( -delta );
     for (unsigned int i = 0; i < mode.y_bindings[modifiers].size(); i++)
       mode.y_bindings[modifiers][i]->fire(double(delta), double(ysize));
   }