]> git.mxchange.org Git - flightgear.git/blobdiff - src/Instrumentation/heading_indicator_dg.cxx
Add --log-class option, improve logging classes.
[flightgear.git] / src / Instrumentation / heading_indicator_dg.cxx
index 9bcd19b672cde496b729f9d48aa587c48c1ec405..d44e0b036f283fccd6a0e3c514168bf5acb23738 100644 (file)
@@ -25,8 +25,8 @@ HeadingIndicatorDG::HeadingIndicatorDG ( SGPropertyNode *node ) :
     int i;
     for ( i = 0; i < node->nChildren(); ++i ) {
         SGPropertyNode *child = node->getChild(i);
-        string cname = child->getName();
-        string cval = child->getStringValue();
+        std::string cname = child->getName();
+        std::string cval = child->getStringValue();
         if ( cname == "name" ) {
             name = cval;
         } else if ( cname == "number" ) {
@@ -51,7 +51,7 @@ HeadingIndicatorDG::~HeadingIndicatorDG ()
 void
 HeadingIndicatorDG::init ()
 {
-    string branch;
+    std::string branch;
     branch = "/instrumentation/" + name;
 
     _heading_in_node = fgGetNode("/orientation/heading-deg", true);
@@ -81,7 +81,7 @@ void
 HeadingIndicatorDG::bind ()
 {
     std::ostringstream temp;
-    string branch;
+    std::string branch;
     temp << num;
     branch = "/instrumentation/" + name + "[" + temp.str() + "]";
 
@@ -95,7 +95,7 @@ void
 HeadingIndicatorDG::unbind ()
 {
     std::ostringstream temp;
-    string branch;
+    std::string branch;
     temp << num;
     branch = "/instrumentation/" + name + "[" + temp.str() + "]";
 
@@ -115,7 +115,7 @@ HeadingIndicatorDG::update (double dt)
                                 // Next, calculate time-based precession
     double offset = _offset_node->getDoubleValue();
     offset -= dt * (0.25 / 60.0); // 360deg/day
-    SG_NORMALIZE_RANGE(offset, -360.0, 360.0);
+    offset = SGMiscd::normalizePeriodic(-360.0,360.0,offset);
     _offset_node->setDoubleValue(offset);
 
                                 // No magvar - set the alignment manually
@@ -125,7 +125,6 @@ HeadingIndicatorDG::update (double dt)
     double yaw_rate = _yaw_rate_node->getDoubleValue();
     double error = _error_node->getDoubleValue();
     double g = _g_node->getDoubleValue();
-    int sign = 0;
 
     if ( fabs ( yaw_rate ) > 5 ) {
         error += 0.033 * -yaw_rate * dt ;
@@ -154,7 +153,7 @@ HeadingIndicatorDG::update (double dt)
     _last_heading_deg = heading;
 
     heading += offset + align + error;
-    SG_NORMALIZE_RANGE(heading, 0.0, 360.0);
+    heading = SGMiscd::normalizePeriodic(0.0,360.0,heading);
 
     _heading_out_node->setDoubleValue(heading);