]> git.mxchange.org Git - flightgear.git/blobdiff - src/Instrumentation/slip_skid_ball.cxx
Pull Sound-manager out of FGGlobals
[flightgear.git] / src / Instrumentation / slip_skid_ball.cxx
index 8b79f4f63cac6d59450c209bfa09e2bc3b4e566c..4bb1f916bdc7ed58b2a7595bc0dff7534a29768b 100644 (file)
@@ -3,35 +3,20 @@
 //
 // This file is in the Public Domain and comes with no warranty.
 
+#ifdef HAVE_CONFIG_H
+#  include "config.h"
+#endif
+
 #include "slip_skid_ball.hxx"
 #include <Main/fg_props.hxx>
 #include <Main/util.hxx>
 
+using std::string;
 
 SlipSkidBall::SlipSkidBall ( SGPropertyNode *node)
     :
-    name("slip-skid-ball"),
-    num(0)
-{
-    int i;
-    for ( i = 0; i < node->nChildren(); ++i ) {
-        SGPropertyNode *child = node->getChild(i);
-        string cname = child->getName();
-        string cval = child->getStringValue();
-        if ( cname == "name" ) {
-            name = cval;
-        } else if ( cname == "number" ) {
-            num = child->getIntValue();
-        } else {
-            SG_LOG( SG_INSTR, SG_WARN, "Error in slip-skid-ball config logic" );
-            if ( name.length() ) {
-                SG_LOG( SG_INSTR, SG_WARN, "Section = " << name );
-            }
-        }
-    }
-}
-
-SlipSkidBall::SlipSkidBall ()
+    _name(node->getStringValue("name", "slip-skid-ball")),
+    _num(node->getIntValue("number", 0))
 {
 }
 
@@ -43,14 +28,22 @@ void
 SlipSkidBall::init ()
 {
     string branch;
-    branch = "/instrumentation/" + name;
+    branch = "/instrumentation/" + _name;
 
-    SGPropertyNode *node = fgGetNode(branch.c_str(), num, true );
+    SGPropertyNode *node = fgGetNode(branch.c_str(), _num, true );
     _serviceable_node = node->getChild("serviceable", 0, true);
     _y_accel_node = fgGetNode("/accelerations/pilot/y-accel-fps_sec", true);
     _z_accel_node = fgGetNode("/accelerations/pilot/z-accel-fps_sec", true);
     _out_node = node->getChild("indicated-slip-skid", 0, true);
-    _override_node = node->getChild("iverride", 0, true);
+    _override_node = node->getChild("override", 0, true);
+
+    reinit();
+}
+
+void
+SlipSkidBall::reinit ()
+{
+    _out_node->setDoubleValue(0.0);
 }
 
 void