]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/Balloon/BalloonSim.cpp
Code reorganization.
[flightgear.git] / src / FDM / Balloon / BalloonSim.cpp
index c3443eec9d251e5806f256313acee96224be9562..92cb0a26f19d77ea8f48320619ff3d4d795bed54 100644 (file)
@@ -42,14 +42,15 @@ HISTORY
 // #include <conio.h>
 #include <math.h>
 
+#include <simgear/constants.h>
+
 #include <Aircraft/aircraft.hxx>
-#include <Include/fg_constants.h>
 #include <Main/options.hxx>
 #include <WeatherCM/FGLocalWeatherDatabase.h>
 
 #include "BalloonSim.h"
 
-#include "sg.h"
+#include <plib/sg.h>
 
 /****************************************************************************/
 /********************************** CODE ************************************/
@@ -106,15 +107,15 @@ void balloon::update()
 {
     /************************************************************************/
     /* I'm  simplifying  the  balloon by  reducing the  simulation  to  two */
-    /* points:                                                              */                                                         
+    /* points:                                                              */ 
     /* the center of the basket (CB) and the center of the envelope (CE)    */
-    /*                                                                      */                                                         
-    /*                                 ce                                   */                                                         
-    /*                                 I                                    */                                                         
-    /*                                 I                                    */                                                         
-    /*                                 cg (=center of gravity)              */                                                         
-    /*                                 I                                    */                                                         
-    /*                                 cb                                   */                                                         
+    /*                                                                      */
+    /*                                 ce                                   */
+    /*                                 I                                    */
+    /*                                 I                                    */
+    /*                                 cg (=center of gravity)              */
+    /*                                 I                                    */
+    /*                                 cb                                   */
     /*                                                                      */
     /* On each center  are forces acting:  gravity and  wind resitance.  CE */
     /* additionally got the lift  (=> I need to calculate the weight of the */
@@ -172,8 +173,9 @@ void balloon::update()
     sgVec3 v;
 
     //get the current wind velocity and store it in v
-    Point3D temp = WeatherDatabase->get(position).Wind;
-    sgSetVec3(v, temp.x(), temp.y(), temp.z());
+    //Point3D temp = WeatherDatabase->get(position).Wind;
+    //sgSetVec3(v, temp.x(), temp.y(), temp.z());
+    sgCopyVec3(v, WeatherDatabase->get(position).Wind );
 
     sgSubVec3(v, velocity);
     float speed = sgLengthVec3(v);
@@ -239,7 +241,7 @@ void balloon::update()
 
     // care for the ground
     if (position[2] < (ground_level+0.001) )
-       velocity[2] = ground_level;
+       position[2] = ground_level;
 
     //return results
     sgAddVec3(position, dTotal);