X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FFDM%2FSP%2FMagicCarpet.cxx;h=822c1aa89f665a3e24ba41c276a511ae0f7590e8;hb=69baf3a9d6adb645325e7bfc0305b09604379d9f;hp=558f39ddbc1339838a3ffe38673ba7d97b636a60;hpb=0824fe68f3fec838c3d0b8500966560c7397047e;p=flightgear.git diff --git a/src/FDM/SP/MagicCarpet.cxx b/src/FDM/SP/MagicCarpet.cxx index 558f39ddb..822c1aa89 100644 --- a/src/FDM/SP/MagicCarpet.cxx +++ b/src/FDM/SP/MagicCarpet.cxx @@ -26,7 +26,6 @@ #endif #include -#include #include #include
@@ -86,7 +85,7 @@ void FGMagicCarpet::update( double dt ) { _set_Euler_Rates(0,0,0); // update (lon/lat) position - double lat2, lon2, az2; + double lat2 = 0.0, lon2 = 0.0, az2 = 0.0; if ( fabs( speed ) > SG_EPSILON ) { geo_direct_wgs_84 ( get_Altitude(), get_Latitude() * SGD_RADIANS_TO_DEGREES, @@ -94,8 +93,7 @@ void FGMagicCarpet::update( double dt ) { get_Psi() * SGD_RADIANS_TO_DEGREES, dist, &lat2, &lon2, &az2 ); - _set_Longitude( lon2 * SGD_DEGREES_TO_RADIANS ); - _set_Latitude( lat2 * SGD_DEGREES_TO_RADIANS ); + _set_Geodetic_Position( lat2 * SGD_DEGREES_TO_RADIANS, lon2 * SGD_DEGREES_TO_RADIANS ); } // cout << "lon error = " << fabs(end.x()*SGD_RADIANS_TO_DEGREES - lon2) @@ -117,4 +115,5 @@ void FGMagicCarpet::update( double dt ) { _update_ground_elev_at_pos(); _set_Sea_level_radius( sl_radius * SG_METER_TO_FEET); _set_Altitude( get_Altitude() + climb ); + _set_Altitude_AGL( get_Altitude() - get_Runway_altitude() ); }