Further tweaks for the new environment subsystem.
This commit is contained in:
parent
ee3500a0a4
commit
254de7695d
2 changed files with 13 additions and 5 deletions
|
@ -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;
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Add table
Reference in a new issue