]> git.mxchange.org Git - flightgear.git/commitdiff
Check return value of FDM::init().
authorcurt <curt>
Mon, 16 Oct 2000 14:54:41 +0000 (14:54 +0000)
committercurt <curt>
Mon, 16 Oct 2000 14:54:41 +0000 (14:54 +0000)
Updated other return values to be bool instead of int.

14 files changed:
src/FDM/Balloon.cxx
src/FDM/Balloon.h
src/FDM/External.cxx
src/FDM/External.hxx
src/FDM/JSBSim.cxx
src/FDM/JSBSim.hxx
src/FDM/JSBSim/FGNozzle.cpp
src/FDM/JSBSim/Makefile.am
src/FDM/LaRCsim.cxx
src/FDM/LaRCsim.hxx
src/FDM/MagicCarpet.cxx
src/FDM/MagicCarpet.hxx
src/FDM/flight.cxx
src/FDM/flight.hxx

index 6a89a73c21b6803e4b2a24a49621712dcbf9218d..211b7c6acf3747d06595175793943bf0062a988f 100644 (file)
@@ -63,7 +63,7 @@ HISTORY
 
 // Initialize the BalloonSim flight model, dt is the time increment for
 // each subsequent iteration through the EOM
-int FGBalloonSim::init( double dt ) {
+bool FGBalloonSim::init( double dt ) {
     sgVec3 temp;
 
     FG_LOG( FG_FLIGHT, FG_INFO, "Starting initializing BalloonSim" );
@@ -96,12 +96,12 @@ int FGBalloonSim::init( double dt ) {
 
     FG_LOG( FG_FLIGHT, FG_INFO, "Finished initializing BalloonSim" );
 
-    return 1;
+    return true;
 }
 
 
 // Run an iteration of the EOM (equations of motion)
-int FGBalloonSim::update( int multiloop ) {
+bool FGBalloonSim::update( int multiloop ) {
     double save_alt = 0.0;
 
     // lets try to avoid really screwing up the BalloonSim model
@@ -151,18 +151,18 @@ int FGBalloonSim::update( int multiloop ) {
        set_Altitude( save_alt );
     }
 
-    return 1;
+    return true;
 }
 
 
 // Convert from the FGInterface struct to the BalloonSim
-int FGBalloonSim::copy_to_BalloonSim() {
-    return 1;
+bool FGBalloonSim::copy_to_BalloonSim() {
+    return true;
 }
 
 
 // Convert from the BalloonSim to the FGInterface struct
-int FGBalloonSim::copy_from_BalloonSim() {
+bool FGBalloonSim::copy_from_BalloonSim() {
 
     sgVec3 temp;
 
@@ -213,7 +213,7 @@ int FGBalloonSim::copy_from_BalloonSim() {
     set_sin_cos_longitude( lon );
     set_sin_cos_latitude( lat_geod );
 
-    return 0;
+    return true;
 }
 
 
index 8ba6275793a92c01321b0f77074dbf8057b99361..e6e0ae095a943dbb4af766d49922cb63d2c80ca2 100644 (file)
@@ -74,16 +74,16 @@ class FGBalloonSim: public FGInterface {
 public:
 
     // copy FDM state to BalloonSim structures
-    int copy_to_BalloonSim();
+    bool copy_to_BalloonSim();
 
     // copy FDM state from BalloonSim structures
-    int copy_from_BalloonSim();
+    bool copy_from_BalloonSim();
 
     // reset flight params to a specific position 
-    int init( double dt );
+    bool init( double dt );
 
     // update position based on inputs, positions, velocities, etc.
-    int update( int multiloop );
+    bool update( int multiloop );
 };
 
 
index 9284c9a4634b67087edd29785a80c11655061876..f5d3b8f4a10ac0f682f4302d8afb8a1f3bf5ed25 100644 (file)
 
 // Initialize the External flight model, dt is the time increment
 // for each subsequent iteration through the EOM
-int FGExternal::init( double dt ) {
+bool FGExternal::init( double dt ) {
     // cout << "FGExternal::init()" << endl;
 
     // set valid time for this record
     stamp_time();
 
-    return 1;
+    return true;
 }
 
 
 // Run an iteration of the EOM.  This is essentially a NOP here
 // because these values are getting filled in elsewhere based on
 // external input.
-int FGExternal::update( int multiloop ) {
+bool FGExternal::update( int multiloop ) {
     // cout << "FGExternal::update()" << endl;
 
     // double time_step = (1.0 / current_options.get_model_hz()) * multiloop;
 
 
-    return 1;
+    return true;
 }
index 159615907bbac3278b9da268cba23e81f49408bd..a9e8c8ef8691418b2822cf7ee6c760a3336f5c59 100644 (file)
@@ -32,10 +32,10 @@ class FGExternal: public FGInterface {
 
 public:
     // reset flight params to a specific position 
-    int init( double dt );
+    bool init( double dt );
 
     // update position based on inputs, positions, velocities, etc.
-    int update( int multiloop );
+    bool update( int multiloop );
 };
 
 
index 6abc5e2a0c01b091737bb5dbb1cd43e7763693f4..db8ee0c3fca8f4b0a204068cb25ace3cb8d9059a 100644 (file)
@@ -60,7 +60,7 @@
 // Initialize the JSBsim flight model, dt is the time increment for
 // each subsequent iteration through the EOM
 
-int FGJSBsim::init( double dt ) {
+bool FGJSBsim::init( double dt ) {
 
   bool result;
 
@@ -83,9 +83,9 @@ int FGJSBsim::init( double dt ) {
   if (result) {
     FG_LOG( FG_FLIGHT, FG_INFO, "  loaded aircraft " << current_options.get_aircraft() );
   } else {
-    FG_LOG( FG_FLIGHT, FG_INFO, "  aircraft" << current_options.get_aircraft()
-                                << " does not exist");
-    return 0;
+    FG_LOG( FG_FLIGHT, FG_INFO, "  aircraft " << current_options.get_aircraft()
+           << " does not exist" );
+    return false;
   }
 
   FDMExec.GetAtmosphere()->SetExTemperature(get_Static_temperature());
@@ -129,9 +129,6 @@ int FGJSBsim::init( double dt ) {
   fgic->SetLatitudeRadIC(get_Lat_geocentric());
   fgic->SetLongitudeRadIC(get_Longitude());
 
-  
-  
-  
   //FG_LOG( FG_FLIGHT, FG_INFO, "  gamma: " <<  current_options.get_Gamma());
   FG_LOG( FG_FLIGHT, FG_INFO, "  phi: " <<  get_Phi());
   //FG_LOG( FG_FLIGHT, FG_INFO, "  theta: " <<  get_Theta() );
@@ -184,14 +181,14 @@ int FGJSBsim::init( double dt ) {
 
   copy_from_JSBsim();
 
-  return 1;
+  return true;
 }
 
 /******************************************************************************/
 
 // Run an iteration of the EOM (equations of motion)
 
-int FGJSBsim::update( int multiloop ) {
+bool FGJSBsim::update( int multiloop ) {
   double save_alt = 0.0;
   double time_step = (1.0 / current_options.get_model_hz()) * multiloop;
   double start_elev = get_Altitude();
@@ -237,14 +234,14 @@ int FGJSBsim::update( int multiloop ) {
 
   double end_elev = get_Altitude();
 
-  return 1;
+  return true;
 }
 
 /******************************************************************************/
 
 // Convert from the FGInterface struct to the JSBsim generic_ struct
 
-int FGJSBsim::copy_to_JSBsim() {
+bool FGJSBsim::copy_to_JSBsim() {
   // copy control positions into the JSBsim structure
 
   FDMExec.GetFCS()->SetDaCmd( controls.get_aileron());
@@ -273,14 +270,14 @@ int FGJSBsim::copy_to_JSBsim() {
                                       get_V_east_airmass(),
                                       get_V_down_airmass());
 
-  return 1;
+  return true;
 }
 
 /******************************************************************************/
 
 // Convert from the JSBsim generic_ struct to the FGInterface struct
 
-int FGJSBsim::copy_from_JSBsim() {
+bool FGJSBsim::copy_from_JSBsim() {
 
   set_Inertias( FDMExec.GetAircraft()->GetMass(),
                 FDMExec.GetAircraft()->GetIxx(),
@@ -391,5 +388,5 @@ int FGJSBsim::copy_from_JSBsim() {
   
   set_Climb_Rate(FDMExec.GetPosition()->Gethdot());
 
-  return 1;
+  return true;
 }
index 093719b7fc291f0a90162c310e092fc912e6cf21..3933678c956a2a5c9bf29b31c7737399a1c49cfc 100644 (file)
@@ -41,16 +41,16 @@ class FGJSBsim: public FGInterface {
 public:
 
     // copy FDM state to LaRCsim structures
-    int copy_to_JSBsim();
+    bool copy_to_JSBsim();
 
     // copy FDM state from LaRCsim structures
-    int copy_from_JSBsim();
+    bool copy_from_JSBsim();
 
     // reset flight params to a specific position 
-    int init( double dt );
+    bool init( double dt );
 
     // update position based on inputs, positions, velocities, etc.
-    int update( int multiloop );
+    bool update( int multiloop );
 };
 
 
index d1ec626e28566ea8093c0e40aab674a26eb24ee2..9c0edbf53eb1cf78cc95bdbe57d0a15e0a27ee49 100644 (file)
@@ -38,7 +38,7 @@ INCLUDES
 #include "FGNozzle.h"
 
 static const char *IdSrc = "$Header$";
-static const char *IdHdr = ID_NOZZLE;
+static const char *IdHdr = "";
 
 /*******************************************************************************
 ************************************ CODE **************************************
index 2bf1260c8483ab1721bffa4fdb11959f0e7e0906..53838094b885d8790b09c4285c070f95e17c495f 100644 (file)
@@ -24,19 +24,14 @@ libJSBSim_a_SOURCES = \
        FGDefs.h \
        FGFCS.cpp FGFCS.h \
        FGFDMExec.cpp FGFDMExec.h \
-       FGForce.cpp FGForce.h \
        FGInitialCondition.cpp FGInitialCondition.h \
        FGLGear.cpp FGLGear.h \
        FGMatrix.cpp FGMatrix.h \
        FGModel.cpp FGModel.h \
-       FGNozzle.cpp FGNozzle.h \
        FGOutput.cpp FGOutput.h \
        FGPosition.cpp FGPosition.h \
-       FGPropeller.cpp FGPropeller.h \
        FGRotation.cpp FGRotation.h \
-       FGRotor.cpp FGRotor.h \
        FGState.cpp FGState.h \
-       FGThruster.cpp FGThruster.h \
        FGTranslation.cpp FGTranslation.h \
        FGTrim.cpp FGTrim.h \
        FGTrimAxis.cpp FGTrimAxis.h \
index 568913cc3ddee456b4d4736598ad261ef489f070..f1e7422364d25fc33bc015370d194f0672010f08 100644 (file)
@@ -37,7 +37,7 @@
 
 // Initialize the LaRCsim flight model, dt is the time increment for
 // each subsequent iteration through the EOM
-int FGLaRCsim::init( double dt ) {
+bool FGLaRCsim::init( double dt ) {
 
     if ( current_options.get_aircraft() == "c172" ) {
        // Initialize our little engine that hopefully might
@@ -79,12 +79,12 @@ int FGLaRCsim::init( double dt ) {
     // set valid time for this record
     stamp_time();
 
-    return 1;
+    return true;
 }
 
 
 // Run an iteration of the EOM (equations of motion)
-int FGLaRCsim::update( int multiloop ) {
+bool FGLaRCsim::update( int multiloop ) {
     // cout << "FGLaRCsim::update()" << endl;
 
     if ( current_options.get_aircraft() == "c172" ) {
@@ -191,12 +191,12 @@ int FGLaRCsim::update( int multiloop ) {
        set_Climb_Rate( (end_elev - start_elev) / time_step );
     }
 
-    return 1;
+    return true;
 }
 
 
 // Convert from the FGInterface struct to the LaRCsim generic_ struct
-int FGLaRCsim::copy_to_LaRCsim () {
+bool FGLaRCsim::copy_to_LaRCsim () {
     Mass =      get_Mass();
     I_xx =      get_I_xx();
     I_yy =      get_I_yy();
@@ -367,12 +367,12 @@ int FGLaRCsim::copy_to_LaRCsim () {
     // Y_pilot_rwy =       get_Y_pilot_rwy();
     // H_pilot_rwy =       get_H_pilot_rwy();
 
-    return 1;
+    return true;
 }
 
 
 // Convert from the LaRCsim generic_ struct to the FGInterface struct
-int FGLaRCsim::copy_from_LaRCsim() {
+bool FGLaRCsim::copy_from_LaRCsim() {
 
     // Mass properties and geometry values
     set_Inertias( Mass, I_xx, I_yy, I_zz, I_xz );
@@ -515,5 +515,5 @@ int FGLaRCsim::copy_from_LaRCsim() {
     // printf("sin_lon     %f  cos_lon     %f\n",
     //        get_sin_longitude(), get_cos_longitude());
 
-    return 1;
+    return true;
 }
index 5007409e6909b71ce980cf0209f9f1ba769e015a..97773f3c9da1a3107083a91d2b46db44b3838a58 100644 (file)
@@ -38,16 +38,16 @@ class FGLaRCsim: public FGInterface {
 public:
 
     // copy FDM state to LaRCsim structures
-    int copy_to_LaRCsim();
+    bool copy_to_LaRCsim();
 
     // copy FDM state from LaRCsim structures
-    int copy_from_LaRCsim();
+    bool copy_from_LaRCsim();
 
     // reset flight params to a specific position 
-    int init( double dt );
+    bool init( double dt );
 
     // update position based on inputs, positions, velocities, etc.
-    int update( int multiloop );
+    bool update( int multiloop );
 };
 
 
index 708046b4dd296b9b0291b28c6019713a04f4cb72..12a018e3dbc9ef59b9f83b9e0a0ae2219b379ddc 100644 (file)
 
 // Initialize the Magic Carpet flight model, dt is the time increment
 // for each subsequent iteration through the EOM
-int FGMagicCarpet::init( double dt ) {
+bool FGMagicCarpet::init( double dt ) {
     // set valid time for this record
     stamp_time();
 
-    return 1;
+    return true;
 }
 
 
 // Run an iteration of the EOM (equations of motion)
-int FGMagicCarpet::update( int multiloop ) {
+bool FGMagicCarpet::update( int multiloop ) {
     // cout << "FGLaRCsim::update()" << endl;
 
     double time_step = (1.0 / current_options.get_model_hz()) * multiloop;
@@ -93,5 +93,5 @@ int FGMagicCarpet::update( int multiloop ) {
     set_Sea_level_radius( sl_radius * METER_TO_FEET);
     set_Altitude( get_Altitude() + climb );
 
-    return 1;
+    return true;
 }
index 5705b8b005fcbd713afd518ac3d533bd2a530c67..21c4ffecc6dc80fa01b8374202acc11ff3156752 100644 (file)
@@ -32,10 +32,10 @@ class FGMagicCarpet: public FGInterface {
 
 public:
     // reset flight params to a specific position 
-    int init( double dt );
+    bool init( double dt );
 
     // update position based on inputs, positions, velocities, etc.
-    int update( int multiloop );
+    bool update( int multiloop );
 };
 
 
index 93a6c27eaa24d33c72ffe749a66dbc4eec39cead..df2da8b7add91dfb7ff064063b2d14be90922936 100644 (file)
@@ -79,15 +79,15 @@ FGInterface::~FGInterface() {
 }
 
 
-int FGInterface::init( double dt ) {
+bool FGInterface::init( double dt ) {
     cout << "dummy init() ... SHOULDN'T BE CALLED!" << endl;
-    return 0;
+    return false;
 }
 
 
-int FGInterface::update( int multi_loop ) {
+bool FGInterface::update( int multi_loop ) {
     cout << "dummy update() ... SHOULDN'T BE CALLED!" << endl;
-    return 0;
+    return false;
 }
 
 
index c9e43e6f0cf630e7afed01edd55c9035ce584f1e..3a724b562ebb973134dd46df62af1498280207d3 100644 (file)
@@ -243,8 +243,8 @@ public:
     FGInterface(void);
     virtual ~FGInterface();
 
-    virtual int init( double dt );
-    virtual int update( int multi_loop );
+    virtual bool init( double dt );
+    virtual bool update( int multi_loop );
 
     // Define the various supported flight models (many not yet implemented)
     enum {