* Update the panel.
*/
void
-FGPanel::update ()
+FGPanel::update (int dt)
{
// Do nothing if the panel isn't visible.
if ( !fgPanelVisible() ) {
virtual void init ();
virtual void bind ();
virtual void unbind ();
- virtual void update ();
+ virtual void update (int dt);
virtual void update (GLfloat winx, GLfloat winw, GLfloat winy, GLfloat winh);
// transfer pointer ownership!!!
blink.stamp();
search();
- update();
+ update(1); // FIXME: use dt
// Search radio database once per second
global_events.Register( "fgRadioSearch()", fgRadioSearch,
// Update the various nav values based on position and valid tuned in navs
void
-FGRadioStack::update()
+FGRadioStack::update(int dt)
{
//DCL
string transmission;
void init ();
void bind ();
void unbind ();
- void update ();
+ void update (int dt);
// Update nav/adf radios based on current postition
void search ();
void
-FGControls::update ()
+FGControls::update (int dt)
{
}
void init ();
void bind ();
void unbind ();
- void update ();
+ void update (int dt);
// Reset function
void reset_all(void);
// Run an iteration of the EOM. This is essentially a NOP here
// because these values are getting filled in elsewhere based on
// external input.
-bool FGADA::update( int multiloop ) {
+void FGADA::update( int multiloop ) {
// cout << "FGADA::update()" << endl;
char Buffer[numberofbytes];
memcpy (&OutBuffer, &visuals_to_sixdof, sizeof (OutBuffer));
int result = fdmsock->write(OutBuffer, nbytes);
}
-
- return true;
}
// Convert from the FGInterface struct to the FGADA struct (output)
void init();
// update position based on inputs, positions, velocities, etc.
- bool update( int multiloop );
+ void update(int dt);
};
// Run an iteration of the EOM (equations of motion)
-bool FGBalloonSim::update( int multiloop ) {
+void FGBalloonSim::update( int multiloop ) {
double save_alt = 0.0;
// lets try to avoid really screwing up the BalloonSim model
if ( save_alt < -9000.0 ) {
set_Altitude( save_alt );
}
-
- return true;
}
void init();
// update position based on inputs, positions, velocities, etc.
- bool update( int multiloop );
+ void update( int multiloop );
};
// Run an iteration of the EOM. This is essentially a NOP here
// because these values are getting filled in elsewhere based on
// external input.
-bool FGExternal::update( int multiloop ) {
+void FGExternal::update( int multiloop ) {
// cout << "FGExternal::update()" << endl;
// double time_step = (1.0 / fgGetInt("/sim/model-hz"))
// * multiloop;
-
-
- return true;
}
void init();
// update position based on inputs, positions, velocities, etc.
- bool update( int multiloop );
+ void update( int multiloop );
};
// Run an iteration of the EOM. This is a NOP here because the flight
// model values are getting filled in elsewhere (most likely from some
// external source.)
-bool FGExternalNet::update( int multiloop ) {
+void FGExternalNet::update( int multiloop ) {
// cout << "FGExternalNet::update()" << endl;
-
- return true;
}
void init();
// update the fdm
- bool update( int multiloop );
+ void update( int multiloop );
};
// Run an iteration of the EOM (equations of motion)
-bool FGJSBsim::update( int multiloop ) {
+void
+FGJSBsim::update( int multiloop ) {
int i;
// translate JSBsim back to FG structure so that the
// autopilot (and the rest of the sim can use the updated values
copy_from_JSBsim();
- return true;
}
/******************************************************************************/
/** Update the position based on inputs, positions, velocities, etc.
@param multiloop number of times to loop through the FDM
@return true if successful */
- bool update( int multiloop );
+ void update( int multiloop );
bool ToggleDataLogging(bool state);
bool ToggleDataLogging(void);
void do_trim(void);
WingIncidence=0;
impending_stall = 0;
- if (debug_lvl & 2) cout << "Instantiated: " << Name << endl;
+ Debug(0);
}
-
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
FGAircraft::~FGAircraft()
{
- if (debug_lvl & 2) cout << "Destroyed: FGAircraft" << endl;
+ Debug(1);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+// The bitmasked value choices are as follows:
+// unset: In this case (the default) JSBSim would only print
+// out the normally expected messages, essentially echoing
+// the config files as they are read. If the environment
+// variable is not set, debug_lvl is set to 1 internally
+// 0: This requests JSBSim not to output any messages
+// whatsoever.
+// 1: This value explicity requests the normal JSBSim
+// startup messages
+// 2: This value asks for a message to be printed out when
+// a class is instantiated
+// 4: When this value is set, a message is displayed when a
+// FGModel object executes its Run() method
+// 8: When this value is set, various runtime state variables
+// are printed out periodically
+// 16: When set various parameters are sanity checked and
+// a message is printed out when they go out of bounds
void FGAircraft::Debug(int from)
{
- //TODO: Add your source code here
+ if (debug_lvl <= 0) return;
+
+ if (debug_lvl & 1) { // Standard console startup message output
+ if (from == 0) { // Constructor
+ }
+ }
+ if (debug_lvl & 2 ) { // Instantiation/Destruction notification
+ if (from == 0) cout << "Instantiated: FGAircraft" << endl;
+ if (from == 1) cout << "Destroyed: FGAircraft" << endl;
+ }
+ if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
+ }
+ if (debug_lvl & 8 ) { // Runtime state variables
+ }
+ if (debug_lvl & 16) { // Sanity checking
+ }
+ if (debug_lvl & 32) { // Turbulence
+ }
}
// Run an iteration of the EOM (equations of motion)
-bool FGLaRCsim::update( int multiloop ) {
+void FGLaRCsim::update( int multiloop ) {
if ( aero->getStringValue() == "c172" ) {
// set control inputs
if ( save_alt < -9000.0 ) {
set_Altitude( save_alt );
}
-
- return true;
}
void init();
// update position based on inputs, positions, velocities, etc.
- bool update( int multiloop );
+ void update( int multiloop );
// Positions
void set_Latitude(double lat); //geocentric
// Run an iteration of the EOM (equations of motion)
-bool FGMagicCarpet::update( int multiloop ) {
+void FGMagicCarpet::update( int multiloop ) {
// cout << "FGLaRCsim::update()" << endl;
double time_step = get_delta_t() * multiloop;
// cout << "(setto) sea level radius (ft) = " << get_Sea_level_radius() << endl;
_set_Sea_level_radius( sl_radius * SG_METER_TO_FEET);
_set_Altitude( get_Altitude() + climb );
-
- return true;
}
void init();
// update position based on inputs, positions, velocities, etc.
- bool update( int multiloop );
+ void update( int multiloop );
};
// Run an iteration of the EOM. This is a NOP here because the flight
// model values are getting filled in elsewhere (most likely from some
// external source.)
-bool FGNullFDM::update( int multiloop ) {
+void FGNullFDM::update( int multiloop ) {
// cout << "FGNullFDM::update()" << endl;
-
- return true;
}
void init();
// update position based on inputs, positions, velocities, etc.
- bool update( int multiloop );
+ void update( int multiloop );
};
set_inited(true);
}
-bool YASim::update(int iterations)
+void YASim::update(int iterations)
{
// If we're crashed, then we don't care
if(_fdm->getAirplane()->getModel()->isCrashed())
- return true;
+ return;
int i;
for(i=0; i<iterations; i++) {
_updateCount = 0;
}
}
-
- return true; // what does this mean?
}
void YASim::copyToYASim(bool copyState)
virtual void init();
// Run an iteration
- virtual bool update(int iterations);
+ virtual void update(int iterations);
private:
void report();
* Update the state of the FDM (i.e. run the equations of motion).
*/
void
-FGInterface::update ()
+FGInterface::update (int dt)
{
- update(1);
-}
-
-
-bool FGInterface::update( int multi_loop ) {
cout << "dummy update() ... SHOULDN'T BE CALLED!" << endl;
- return false;
}
virtual void init ();
virtual void bind ();
virtual void unbind ();
- virtual void update ();
- virtual bool update( int multi_loop );
+ virtual void update(int dt);
virtual bool ToggleDataLogging(bool state) { return false; }
virtual bool ToggleDataLogging(void) { return false; }
}
void
-FGInput::update ()
+FGInput::update (int dt)
{
_update_keyboard();
_update_joystick();
virtual void init ();
virtual void bind ();
virtual void unbind ();
- virtual void update ();
+ virtual void update (int dt);
/**
* update its state. If the subsystem requires delta time information,
* it should track it itself.</p>
*/
- virtual void update () = 0;
+ virtual void update (int dt) = 0;
};
// glDisable( GL_TEXTURE_2D );
// update the input subsystem
- current_input.update();
+ current_input.update(1); // FIXME: use real dt
// update the controls subsystem
- globals->get_controls()->update();
+ globals->get_controls()->update(1); // FIXME: use real dt
hud_and_panel->apply();
fgCockpitUpdate();
// update the panel subsystem
if ( current_panel != NULL ) {
- current_panel->update();
+ current_panel->update(1); // FIXME: use real dt
}
// We can do translucent menus, so why not. :-)
cur_fdm_state->get_Latitude() );
// Update radio stack model
- current_radiostack->update();
+ current_radiostack->update(1); // FIXME: use dt
}
// Run audio scheduler
#ifdef ENABLE_AUDIO_SUPPORT
if ( fgGetBool("/sim/sound") && globals->get_soundmgr()->is_working() ) {
- globals->get_fx()->update();
- globals->get_soundmgr()->update();
+ globals->get_fx()->update(1); // FIXME: use dt
+ globals->get_soundmgr()->update(1); // FIXME: use dt
}
#endif
void FGScenery::init() {
}
-void FGScenery::update() {
+void FGScenery::update(int dt) {
}
void FGScenery::bind() {
void init ();
void bind ();
void unbind ();
- void update ();
+ void update (int dt);
inline double get_cur_elev() const { return cur_elev; }
inline void set_cur_elev( double e ) { cur_elev = e; }
}
void
-FGFX::update ()
+FGFX::update (int dt)
{
FGSoundMgr * mgr = globals->get_soundmgr();
int i;
virtual void init ();
virtual void bind ();
virtual void unbind ();
- virtual void update ();
+ virtual void update (int dt);
private:
// run the audio scheduler
-void FGSoundMgr::update() {
+void FGSoundMgr::update(int dt) {
SGTimeStamp current;
current.stamp();
/**
* Run the audio scheduler.
*/
- void update();
+ void update(int dt);
// is audio working?