]> git.mxchange.org Git - flightgear.git/blobdiff - src/Instrumentation/slip_skid_ball.cxx
- fix unzoomed tapes (TODO: restore tick length)
[flightgear.git] / src / Instrumentation / slip_skid_ball.cxx
index 3d2c8c4758e77f01bb333774b63dbd5378ca61e5..9f4193ee5b2ad1b5263bbdcfd6acbae496b2d473 100644 (file)
@@ -8,6 +8,29 @@
 #include <Main/util.hxx>
 
 
+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 ()
 {
 }
@@ -19,18 +42,21 @@ SlipSkidBall::~SlipSkidBall ()
 void
 SlipSkidBall::init ()
 {
-    _serviceable_node =
-        fgGetNode("/instrumentation/slip-skid-ball/serviceable", true);
+    string branch;
+    branch = "/instrumentation/" + name;
+
+    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 =
-        fgGetNode("/instrumentation/slip-skid-ball/indicated-slip-skid", true);
+    _out_node = node->getChild("indicated-slip-skid", 0, true);
+    _override_node = node->getChild("override", 0, true);
 }
 
 void
 SlipSkidBall::update (double delta_time_sec)
 {
-    if (_serviceable_node->getBoolValue()) {
+    if (_serviceable_node->getBoolValue() && !_override_node->getBoolValue()) {
         double d = -_z_accel_node->getDoubleValue();
         if (d < 1.0)
             d = 1.0;