X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FFDM%2FBalloon.cxx;h=9d7f19bad4d59d0664adb832b389187bf5ec2347;hb=e6c6c666c2d71fed0d1cd7176a793f8055bad14c;hp=86e0f7156c3621874d0298eb55154b5f1ca3d739;hpb=96b88e539f769c0e0d70d112d7f98f6843760e10;p=flightgear.git diff --git a/src/FDM/Balloon.cxx b/src/FDM/Balloon.cxx index 86e0f7156..9d7f19bad 100644 --- a/src/FDM/Balloon.cxx +++ b/src/FDM/Balloon.cxx @@ -37,6 +37,10 @@ HISTORY /* INCLUDES */ /****************************************************************************/ +#ifdef HAVE_CONFIG_H +# include +#endif + #include #ifdef SG_MATH_EXCEPTION_CLASH @@ -75,9 +79,11 @@ FGBalloonSim::~FGBalloonSim() { // Initialize the BalloonSim flight model, dt is the time increment for // each subsequent iteration through the EOM void FGBalloonSim::init() { - // explicitly call the superclass's - // init method first. - FGInterface::init(); + + //do init common to all the FDM's + common_init(); + + //now do init specific to the Balloon sgVec3 temp; @@ -101,9 +107,9 @@ void FGBalloonSim::init() { //set velocities sgSetVec3( temp, - fgGetDouble("/velocities/uBody-fps"), - fgGetDouble("/velocities/vBody-fps"), - fgGetDouble("/velocities/wBody-fps") ); + 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" ); @@ -111,9 +117,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(); @@ -160,8 +171,6 @@ bool FGBalloonSim::update( int multiloop ) { if ( save_alt < -9000.0 ) { set_Altitude( save_alt ); } - - return true; } @@ -190,7 +199,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] );