]> git.mxchange.org Git - flightgear.git/blobdiff - src/Main/fg_props.cxx
#591: night-time rendering issues, avoid negative color values
[flightgear.git] / src / Main / fg_props.cxx
index 103fafecd96ed7d0dc423ede1a5df174f82d0f4f..63777e3bbba215aa4075f5d08db14efd282f9089 100644 (file)
@@ -127,7 +127,7 @@ addLoggingClass (const string &name)
 /**
  * Set the logging classes.
  */
-static void
+void
 setLoggingClasses (const char * c)
 {
   string classes = c;
@@ -147,12 +147,16 @@ setLoggingClasses (const char * c)
 
   string rest = classes;
   string name = "";
-  int sep = rest.find('|');
-  while (sep > 0) {
+  string::size_type sep = rest.find('|');
+  if (sep == string::npos)
+    sep = rest.find(',');
+  while (sep != string::npos) {
     name = rest.substr(0, sep);
     rest = rest.substr(sep+1);
     addLoggingClass(name);
     sep = rest.find('|');
+    if (sep == string::npos)
+      sep = rest.find(',');
   }
   addLoggingClass(rest);
   SG_LOG(SG_GENERAL, SG_INFO, "Set logging classes to "
@@ -188,7 +192,7 @@ getLoggingPriority ()
 /**
  * Set the logging priority.
  */
-static void
+void
 setLoggingPriority (const char * p)
 {
   if (p == 0)
@@ -361,10 +365,8 @@ getMagDip ()
 static double
 getHeadingMag ()
 {
-  double magheading;
-  magheading = fgGetDouble("/orientation/heading-deg") - getMagVar();
-  if (magheading < 0) magheading += 360;
-  return magheading;
+  double magheading = fgGetDouble("/orientation/heading-deg") - getMagVar();
+  return SGMiscd::normalizePeriodic(0, 360, magheading );
 }
 
 /**
@@ -373,10 +375,8 @@ getHeadingMag ()
 static double
 getTrackMag ()
 {
-  double magtrack;
-  magtrack = fgGetDouble("/orientation/track-deg") - getMagVar();
-  if (magtrack < 0) magtrack += 360;
-  return magtrack;
+  double magtrack = fgGetDouble("/orientation/track-deg") - getMagVar();
+  return SGMiscd::normalizePeriodic(0, 360, magtrack );
 }
 
 static bool