diff --git a/src/AIModel/AICarrier.cxx b/src/AIModel/AICarrier.cxx index 1a9a1d2b7..979e9710b 100644 --- a/src/AIModel/AICarrier.cxx +++ b/src/AIModel/AICarrier.cxx @@ -514,7 +514,7 @@ void FGAICarrier::UpdateWind( double dt) { + (rel_wind_speed_from_north_kts * rel_wind_speed_from_north_kts)); //calculate the relative wind direction - rel_wind_from_deg = atan(rel_wind_speed_from_east_kts/rel_wind_speed_from_north_kts) + rel_wind_from_deg = atan2(rel_wind_speed_from_east_kts, rel_wind_speed_from_north_kts) * SG_RADIANS_TO_DEGREES; // rationalise the output diff --git a/src/Environment/fgmetar.cxx b/src/Environment/fgmetar.cxx index a543832e7..b2b331fbf 100644 --- a/src/Environment/fgmetar.cxx +++ b/src/Environment/fgmetar.cxx @@ -99,6 +99,8 @@ FGMetar::FGMetar(const string& icao, const string& proxy, const string& port, co _wind_range_from = _wind_range_to = _wind_dir; } + if (_wind_speed == SGMetarNaN) + _wind_speed = 0.0; if (_gust_speed == SGMetarNaN) _gust_speed = 0.0; diff --git a/src/FDM/YASim/PistonEngine.cpp b/src/FDM/YASim/PistonEngine.cpp index 11b04fe7a..b032342d4 100644 --- a/src/FDM/YASim/PistonEngine.cpp +++ b/src/FDM/YASim/PistonEngine.cpp @@ -169,7 +169,7 @@ void PistonEngine::calc(float pressure, float temp, float speed) // pressure change can be assumed to be adiabatic. Calculate a // temperature change, and use that to get the density. // Note: need to model intercoolers here... - float T = temp * Math::pow(_mp/pressure, 2.0/7.0); + float T = temp * Math::pow((_mp*_mp)/(pressure*pressure), 1.0/7.0); float rho = _mp / (287.1f * T); // The actual fuel flow is determined only by engine RPM and the diff --git a/src/Main/CameraGroup.cxx b/src/Main/CameraGroup.cxx index 2ff1bb169..c8e23c229 100644 --- a/src/Main/CameraGroup.cxx +++ b/src/Main/CameraGroup.cxx @@ -219,9 +219,11 @@ void CameraGroup::update(const osg::Vec3d& position, void CameraGroup::setCameraParameters(float vfov, float aspectRatio) { - _viewer->getCamera()->setProjectionMatrixAsPerspective(vfov, - 1.0f / aspectRatio, - _zNear, _zFar); + if (vfov != 0.0f && aspectRatio != 0.0f) + _viewer->getCamera() + ->setProjectionMatrixAsPerspective(vfov, + 1.0f / aspectRatio, + _zNear, _zFar); } }