]> git.mxchange.org Git - flightgear.git/commitdiff
Update magvar model before using it to initialize compass error.
authordavid <david>
Thu, 17 Jul 2003 00:26:38 +0000 (00:26 +0000)
committerdavid <david>
Thu, 17 Jul 2003 00:26:38 +0000 (00:26 +0000)
src/Main/main.cxx

index 2a80636555b91bc813f93449f4009fe696c5efc0..7299f0eede5ec40cb9ae4f9b3a2726579bf5d6ec 100644 (file)
@@ -1778,8 +1778,16 @@ static bool fgMainInit( int argc, char **argv ) {
                                 // kludge to initialize mag compass
                                 // (should only be done for in-flight
                                 // startup)
-    fgSetDouble("/instrumentation/heading-indicator/offset-deg",
-                globals->get_mag()->get_magvar() * SGD_RADIANS_TO_DEGREES);
+    // update magvar model
+    globals->get_mag()->update( fgGetDouble("/position/longitude-deg")
+                                * SGD_DEGREES_TO_RADIANS,
+                                fgGetDouble("/position/latitude-deg")
+                                * SGD_DEGREES_TO_RADIANS,
+                                fgGetDouble("/position/altitude-ft")
+                                * SG_FEET_TO_METER,
+                                globals->get_time_params()->getJD() );
+    double var = globals->get_mag()->get_magvar() * SGD_RADIANS_TO_DEGREES;
+    fgSetDouble("/instrumentation/heading-indicator/offset-deg", -var);
 
     // airport = new ssgBranch;
     // airport->setName( "Airport Lighting" );