From 1ce2924c28da536dd7d0830f505eb6566fdd67a1 Mon Sep 17 00:00:00 2001 From: torsten Date: Fri, 24 Apr 2009 20:38:05 +0000 Subject: [PATCH] one final(?) cleanup: - no need for sign() to be a class member - rename local ground elevation variable and make it method local --- src/Environment/ridge_lift.cxx | 13 +++++++++---- src/Environment/ridge_lift.hxx | 8 -------- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/src/Environment/ridge_lift.cxx b/src/Environment/ridge_lift.cxx index 0edbe2e85..fa121a1a5 100644 --- a/src/Environment/ridge_lift.cxx +++ b/src/Environment/ridge_lift.cxx @@ -51,6 +51,10 @@ static string CreateIndexedPropertyName(string Property, int index) return Property + "[" + tmp + "]"; } +static inline double sign(double x) { + return x == 0 ? 0 : x > 0 ? 1.0 : -1.0; +} + static const double BOUNDARY1_m = 40.0; //constructor @@ -166,10 +170,11 @@ void FGRidgeLift::update(double dt) { } for (int i = 0; i < sizeof(probe_elev_m)/sizeof(probe_elev_m[0]); i++) { + double elevation = 0; if (globals->get_scenery()->get_elevation_m(SGGeod::fromGeodM( - SGGeod::fromRad(probe_lon_rad[i],probe_lat_rad[i]), 20000), alt, 0)) { - if ( alt > 0.1 ) { - probe_elev_m[i] = alt; + SGGeod::fromRad(probe_lon_rad[i],probe_lat_rad[i]), 20000), elevation, 0)) { + if ( elevation > 0.1 ) { + probe_elev_m[i] = elevation; } else { probe_elev_m[i] = 0.1 ; } @@ -212,7 +217,7 @@ void FGRidgeLift::update(double dt) { double user_altitude_agl_m = _user_altitude_agl_ft_node->getDoubleValue() * SG_FEET_TO_METER; //boundaries - double boundary2_m = 130.0; // in the lift + double boundary2_m = 130.0; // in the lift if (lift_factor < 0.0) { // in the sink double highest_probe_temp= max ( probe_elev_m[1], probe_elev_m[2] ); double highest_probe_downwind_m= max ( highest_probe_temp, probe_elev_m[3] ); diff --git a/src/Environment/ridge_lift.hxx b/src/Environment/ridge_lift.hxx index a4768d8de..999c8e63e 100644 --- a/src/Environment/ridge_lift.hxx +++ b/src/Environment/ridge_lift.hxx @@ -56,8 +56,6 @@ public: inline double get_slope( int index ) const { return slope[index]; }; private: - //void init(); - double dist_probe_m[5]; double strength; @@ -69,18 +67,12 @@ private: double probe_lat_deg[5]; double probe_lon_deg[5]; - double alt; double probe_elev_m[5]; double slope[4]; double lift_factor; - inline double sign(double x) const { - if( x == 0 ) return 0; - return x > 0 ? 1.0 : -1.0; - } - SGPropertyNode_ptr _ridge_lift_fps_node; SGPropertyNode_ptr _surface_wind_from_deg_node;