]> git.mxchange.org Git - flightgear.git/commitdiff
Further tweaks for the new environment subsystem.
authordavid <david>
Tue, 19 Feb 2002 16:25:38 +0000 (16:25 +0000)
committerdavid <david>
Tue, 19 Feb 2002 16:25:38 +0000 (16:25 +0000)
src/Environment/environment.cxx
src/Main/options.cxx

index c8703b33876c4a9ac06007f9a7d28b11aac8f55e..6fd317a744cf74bf8230a217c0b6c480b7425358 100644 (file)
@@ -84,15 +84,15 @@ FGEnvironment::bind ()
        &FGEnvironment::get_wind_speed_kt, &FGEnvironment::set_wind_speed_kt);
   fgTie("/environment/wind-from-north-fps", this,
        &FGEnvironment::get_wind_from_north_fps,
-       &FGEnvironment::set_wind_from_north_fps, false);
+       &FGEnvironment::set_wind_from_north_fps);
   fgSetArchivable("/environment/wind-from-north-fps");
   fgTie("/environment/wind-from-east-fps", this,
        &FGEnvironment::get_wind_from_east_fps,
-       &FGEnvironment::set_wind_from_east_fps, false);
+       &FGEnvironment::set_wind_from_east_fps);
   fgSetArchivable("/environment/wind-from-east-fps");
   fgTie("/environment/wind-from-down-fps", this,
        &FGEnvironment::get_wind_from_down_fps,
-       &FGEnvironment::set_wind_from_down_fps, false);
+       &FGEnvironment::set_wind_from_down_fps);
   fgSetArchivable("/environment/wind-from-down-fps");
 }
 
@@ -176,7 +176,13 @@ FGEnvironment::set_wind_from_down_fps (double d)
 void
 FGEnvironment::_recalc_hdgspd ()
 {
-  double angle_rad = atan(wind_from_north_fps/wind_from_east_fps);
+  double angle_rad;
+
+  if (wind_from_east_fps == 0) {
+    angle_rad = (wind_from_north_fps >= 0 ? SGD_PI/2 : -SGD_PI/2);
+  } else {
+    angle_rad = atan(wind_from_north_fps/wind_from_east_fps);
+  }
   wind_from_heading_deg = angle_rad * SGD_RADIANS_TO_DEGREES;
   if (wind_from_east_fps >= 0)
     wind_from_heading_deg = 90 - wind_from_heading_deg;
index 6ed75c8497e69bf4817e33cc3c329c18f05b3046..5fbc483faa5cfbba6c91d194e9471ce59ec71fcc 100644 (file)
@@ -900,8 +900,9 @@ parse_option (const string& arg)
        SG_LOG(SG_GENERAL, SG_INFO, "WIND: " << dir << '@' << 
               speed << " knots" << endl);
        fgSetDouble("/environment/wind-from-heading-deg", dir);
-       fgSetDouble("/environment/wind-speed-knots", speed);
+       fgSetDouble("/environment/wind-speed-kt", speed);
 
+#if !defined (FG_NEW_ENVIRONMENT)
         // convert to fps
        speed *= SG_NM_TO_METER * SG_METER_TO_FEET * (1.0/3600);
        while (dir > 360)
@@ -913,6 +914,7 @@ parse_option (const string& arg)
                    speed * cos(dir));
        fgSetDouble("/environment/wind-from-east-fps",
                    speed * sin(dir));
+#endif // FG_NEW_ENVIRONMENT
     } else if ( arg.find( "--wp=" ) == 0 ) {
        parse_wp( arg.substr( 5 ) );
     } else if ( arg.find( "--flight-plan=") == 0) {