]> git.mxchange.org Git - flightgear.git/blobdiff - src/Main/fg_props.cxx
Enable light source for transparent surfaces
[flightgear.git] / src / Main / fg_props.cxx
index 1e62405704de4be6cb45668ac9706d4182eb9d00..807c92118990a972504bdbc36d020b845ec5196d 100644 (file)
@@ -365,11 +365,8 @@ getMagDip ()
 static double
 getHeadingMag ()
 {
-  double magheading;
-  magheading = fgGetDouble("/orientation/heading-deg") - getMagVar();
-  if (magheading <= 0) magheading += 360;
-  else if (magheading > 360) magheading -= 360;
-  return magheading;
+  double magheading = fgGetDouble("/orientation/heading-deg") - getMagVar();
+  return SGMiscd::normalizePeriodic(0, 360, magheading );
 }
 
 /**
@@ -378,11 +375,8 @@ getHeadingMag ()
 static double
 getTrackMag ()
 {
-  double magtrack;
-  magtrack = fgGetDouble("/orientation/track-deg") - getMagVar();
-  if (magtrack <= 0) magtrack += 360;
-  else if (magtrack > 360) magtrack -= 360;
-  return magtrack;
+  double magtrack = fgGetDouble("/orientation/track-deg") - getMagVar();
+  return SGMiscd::normalizePeriodic(0, 360, magtrack );
 }
 
 static bool
@@ -488,58 +482,37 @@ FGProperties::init ()
 void
 FGProperties::bind ()
 {
-                               // Simulation
-  fgTie("/sim/logging/priority", getLoggingPriority, setLoggingPriority);
-  fgTie("/sim/logging/classes", getLoggingClasses, setLoggingClasses);
-  fgTie("/sim/freeze/master", getFreeze, setFreeze);
+  _tiedProperties.setRoot(globals->get_props());
 
-  fgTie("/sim/time/elapsed-sec", getElapsedTime_sec);
-  fgTie("/sim/time/gmt", getDateString, setDateString);
+  // Simulation
+  _tiedProperties.Tie("/sim/logging/priority", getLoggingPriority, setLoggingPriority);
+  _tiedProperties.Tie("/sim/logging/classes", getLoggingClasses, setLoggingClasses);
+  _tiedProperties.Tie("/sim/freeze/master", getFreeze, setFreeze);
+
+  _tiedProperties.Tie("/sim/time/elapsed-sec", getElapsedTime_sec);
+  _tiedProperties.Tie("/sim/time/gmt", getDateString, setDateString);
   fgSetArchivable("/sim/time/gmt");
-  fgTie("/sim/time/gmt-string", getGMTString);
+  _tiedProperties.Tie("/sim/time/gmt-string", getGMTString);
 
-                               // Position
-  fgTie("/position/latitude-string", getLatitudeString);
-  fgTie("/position/longitude-string", getLongitudeString);
+  // Position
+  _tiedProperties.Tie("/position/latitude-string", getLatitudeString);
+  _tiedProperties.Tie("/position/longitude-string", getLongitudeString);
 
-                               // Orientation
-  fgTie("/orientation/heading-magnetic-deg", getHeadingMag);
-  fgTie("/orientation/track-magnetic-deg", getTrackMag);
+  // Orientation
+  _tiedProperties.Tie("/orientation/heading-magnetic-deg", getHeadingMag);
+  _tiedProperties.Tie("/orientation/track-magnetic-deg", getTrackMag);
 
-  fgTie("/environment/magnetic-variation-deg", getMagVar);
-  fgTie("/environment/magnetic-dip-deg", getMagDip);
+  _tiedProperties.Tie("/environment/magnetic-variation-deg", getMagVar);
+  _tiedProperties.Tie("/environment/magnetic-dip-deg", getMagDip);
 
-                               // Misc. Temporary junk.
-  fgTie("/sim/temp/winding-ccw", getWindingCCW, setWindingCCW, false);
+  // Misc. Temporary junk.
+  _tiedProperties.Tie("/sim/temp/winding-ccw", getWindingCCW, setWindingCCW, false);
 }
 
 void
 FGProperties::unbind ()
 {
-                               // Simulation
-  fgUntie("/sim/logging/priority");
-  fgUntie("/sim/logging/classes");
-  fgUntie("/sim/freeze/master");
-
-  fgUntie("/sim/time/elapsed-sec");
-  fgUntie("/sim/time/gmt");
-  fgUntie("/sim/time/gmt-string");
-                               // Position
-  fgUntie("/position/latitude-string");
-  fgUntie("/position/longitude-string");
-
-                               // Orientation
-  fgUntie("/orientation/heading-magnetic-deg");
-  fgUntie("/orientation/track-magnetic-deg");
-
-                               // Environment
-  fgUntie("/environment/magnetic-variation-deg");
-  fgUntie("/environment/magnetic-dip-deg");
-
-                               // Misc. Temporary junk.
-  fgUntie("/sim/temp/winding-ccw");
-//  fgUntie("/sim/temp/full-screen");
-//  fgUntie("/sim/temp/fdm-data-logging");
+    _tiedProperties.Untie();
 }
 
 void
@@ -548,7 +521,6 @@ FGProperties::update (double dt)
     static SGPropertyNode_ptr offset = fgGetNode("/sim/time/local-offset", true);
     offset->setIntValue(globals->get_time_params()->get_local_offset());
 
-
     // utc date/time
     static SGPropertyNode_ptr uyear = fgGetNode("/sim/time/utc/year", true);
     static SGPropertyNode_ptr umonth = fgGetNode("/sim/time/utc/month", true);