X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FFDM%2FBalloon.cxx;h=7ff92a6fcb4b0910686ca634c2ad792d622bbbaf;hb=3ec74d79c23347add2afa088b05ad29af975f65f;hp=af5ffc7a0a9f742774d046873a7efe9fcda55dab;hpb=182fd42b4017fa54d680508c092ea1b216398a00;p=flightgear.git diff --git a/src/FDM/Balloon.cxx b/src/FDM/Balloon.cxx index af5ffc7a0..7ff92a6fc 100644 --- a/src/FDM/Balloon.cxx +++ b/src/FDM/Balloon.cxx @@ -17,9 +17,9 @@ FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License along with - this program; if not, write to the Free Software Foundation, Inc., 59 Temple - Place - Suite 330, Boston, MA 02111-1307, USA. + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Further information about the GNU General Public License can also be found on the world wide web at http://www.gnu.org. @@ -37,6 +37,10 @@ HISTORY /* INCLUDES */ /****************************************************************************/ +#ifdef HAVE_CONFIG_H +# include +#endif + #include #ifdef SG_MATH_EXCEPTION_CLASH @@ -48,10 +52,9 @@ HISTORY #include #include #include -#include +#include #include -#include #include
#include
@@ -75,6 +78,12 @@ FGBalloonSim::~FGBalloonSim() { // Initialize the BalloonSim flight model, dt is the time increment for // each subsequent iteration through the EOM void FGBalloonSim::init() { + + //do init common to all the FDM's + common_init(); + + //now do init specific to the Balloon + sgVec3 temp; SG_LOG( SG_FLIGHT, SG_INFO, "Starting initializing BalloonSim" ); @@ -97,9 +106,9 @@ void FGBalloonSim::init() { //set velocities sgSetVec3( temp, - fgGetDouble("/velocities/uBody"), - fgGetDouble("/velocities/vBody"), - fgGetDouble("/velocities/wBody") ); + fgGetDouble("/sim/presets/uBody-fps"), + fgGetDouble("/sim/presets/vBody-fps"), + fgGetDouble("/sim/presets/wBody-fps") ); current_balloon.setVelocity( temp ); SG_LOG( SG_FLIGHT, SG_INFO, "Finished initializing BalloonSim" ); @@ -107,9 +116,14 @@ void FGBalloonSim::init() { // Run an iteration of the EOM (equations of motion) -bool FGBalloonSim::update( int multiloop ) { +void FGBalloonSim::update( double dt ) { double save_alt = 0.0; + if (is_suspended()) + return; + + int multiloop = _calc_multiloop(dt); + // lets try to avoid really screwing up the BalloonSim model if ( get_Altitude() < -9000 ) { save_alt = get_Altitude(); @@ -117,7 +131,7 @@ bool FGBalloonSim::update( int multiloop ) { } // set control positions - current_balloon.set_burner_strength ( controls.get_throttle(0) ); + current_balloon.set_burner_strength ( globals->get_controls()->get_throttle(0) ); //not more implemented yet // Inform BalloonSim of the local terrain altitude @@ -156,8 +170,6 @@ bool FGBalloonSim::update( int multiloop ) { if ( save_alt < -9000.0 ) { set_Altitude( save_alt ); } - - return true; } @@ -186,7 +198,7 @@ bool FGBalloonSim::copy_from_BalloonSim() { //temp[1]: longitude //temp[2]: altitude (meters) - _updatePosition( temp[0], temp[1], temp[2] * SG_METER_TO_FEET ); + _updateGeocentricPosition( temp[0], temp[1], temp[2] * SG_METER_TO_FEET ); current_balloon.getHPR( temp ); set_Euler_Angles( temp[0], temp[1], temp[2] );