]> git.mxchange.org Git - flightgear.git/blobdiff - src/Instrumentation/attitude_indicator.cxx
don't be afraid of the comma operator!
[flightgear.git] / src / Instrumentation / attitude_indicator.cxx
index 82cb4c6a0f24bc871d2b412184d363eadcbc80bc..1555c2c74eeddc49dda9b2656043e8c89544b711 100644 (file)
@@ -6,6 +6,12 @@
 // TODO:
 // - better spin-up
 
+#include <simgear/compiler.h>
+
+#include STL_IOSTREAM
+#include STL_STRING
+#include <sstream>
+
 #include <math.h>      // fabs()
 
 #include "attitude_indicator.hxx"
@@ -31,9 +37,9 @@ AttitudeIndicator::AttitudeIndicator ( SGPropertyNode *node )
         } else if ( cname == "vacuum-system" ) {
             vacuum_system = cval;
         } else {
-            SG_LOG( SG_AUTOPILOT, SG_WARN, "Error in attitude-indicator config logic" );
+            SG_LOG( SG_INSTR, SG_WARN, "Error in attitude-indicator config logic" );
             if ( name.length() ) {
-                SG_LOG( SG_AUTOPILOT, SG_WARN, "Section = " << name );
+                SG_LOG( SG_INSTR, SG_WARN, "Section = " << name );
             }
         }
     }
@@ -67,32 +73,32 @@ AttitudeIndicator::init ()
     _roll_int_node = node->getChild("internal-roll-deg", 0, true);
     _pitch_out_node = node->getChild("indicated-pitch-deg", 0, true);
     _roll_out_node = node->getChild("indicated-roll-deg", 0, true);
-
-    //_serviceable_node->setBoolValue(true);
 }
 
 void
 AttitudeIndicator::bind ()
 {
+    std::ostringstream temp;
     string branch;
-    branch = "/instrumentation/" + name + "/serviceable";
+    temp << num;
+    branch = "/instrumentation/" + name + "[" + temp.str() + "]";
 
-    fgTie(branch.c_str(),
+    fgTie((branch + "/serviceable").c_str(),
           &_gyro, &Gyro::is_serviceable, &Gyro::set_serviceable);
-    branch = "/instrumentation/" + name + "/spin";
-    fgTie(branch.c_str(),
+    fgTie((branch + "/spin").c_str(),
           &_gyro, &Gyro::get_spin_norm, &Gyro::set_spin_norm);
 }
 
 void
 AttitudeIndicator::unbind ()
 {
+    std::ostringstream temp;
     string branch;
-    branch = "/instrumentation/" + name + "/serviceable";
+    temp << num;
+    branch = "/instrumentation/" + name + "[" + temp.str() + "]";
 
-    fgUntie(branch.c_str());
-    branch = "/instrumentation/" + name + "/spin";
-    fgUntie(branch.c_str());
+    fgUntie((branch + "/serviceable").c_str());
+    fgUntie((branch + "/spin").c_str());
 }
 
 void