]> git.mxchange.org Git - flightgear.git/commitdiff
one final(?) cleanup:
authortorsten <torsten>
Fri, 24 Apr 2009 20:38:05 +0000 (20:38 +0000)
committerTim Moore <timoore@redhat.com>
Fri, 1 May 2009 22:44:21 +0000 (00:44 +0200)
- no need for sign() to be a class member
- rename local ground elevation variable and make it method local

src/Environment/ridge_lift.cxx
src/Environment/ridge_lift.hxx

index 0edbe2e85505bac6e920d5077391afc385819229..fa121a1a5ca5f984d065ac4063aae7d6cfc9dec4 100644 (file)
@@ -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] );
index a4768d8dec04bb25d6794b8e2f7a569455cdf3eb..999c8e63ea52a889df464ac2ba847ac1008306b4 100644 (file)
@@ -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;