]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/YASim/Wing.cpp
FGPUIDialog: fix reading from already free'd memory.
[flightgear.git] / src / FDM / YASim / Wing.cpp
index 12fb438f1482ba8919becf109575256576e17486..1a68244962bd91a54815c94c8229bc779f18588e 100644 (file)
@@ -1,6 +1,7 @@
 #include "Math.hpp"
 #include "Surface.hpp"
 #include "Wing.hpp"
+
 namespace yasim {
 
 Wing::Wing()
@@ -176,6 +177,16 @@ void Wing::setFlap0(float lval, float rval)
     }
 }
 
+void Wing::setFlap0Effectiveness(float lval)
+{
+    lval = Math::clamp(lval, 1, 10);
+    int i;
+    for(i=0; i<_flap0Surfs.size(); i++) {
+        ((Surface*)_flap0Surfs.get(i))->setFlapEffectiveness(lval);
+//     if(_mirror) ((Surface*)_flap0Surfs.get(++i))->setFlapEffectiveness(rval);
+    }
+}
+
 void Wing::setFlap1(float lval, float rval)
 {
     lval = Math::clamp(lval, -1, 1);
@@ -187,6 +198,16 @@ void Wing::setFlap1(float lval, float rval)
     }
 }
 
+void Wing::setFlap1Effectiveness(float lval)
+{
+    lval = Math::clamp(lval, 1, 10);
+    int i;
+    for(i=0; i<_flap1Surfs.size(); i++) {
+        ((Surface*)_flap1Surfs.get(i))->setFlapEffectiveness(lval);
+//     if(_mirror) ((Surface*)_flap1Surfs.get(++i))->setFlap(rval);
+    }
+}
+
 void Wing::setSpoiler(float lval, float rval)
 {
     lval = Math::clamp(lval, 0, 1);
@@ -233,7 +254,7 @@ bool Wing::isMirrored()
 void Wing::compile()
 {
     // Have we already been compiled?
-    if(_surfs.size() != 0) return;
+    if(! _surfs.empty()) return;
 
     // Assemble the start/end coordinates of all control surfaces
     // and the wing itself into an array, sort them,