]> git.mxchange.org Git - flightgear.git/commitdiff
Die if I/O Channel config fails for any reason.
authorcurt <curt>
Wed, 4 Oct 2000 20:50:38 +0000 (20:50 +0000)
committercurt <curt>
Wed, 4 Oct 2000 20:50:38 +0000 (20:50 +0000)
Add an I/O Shutdown function call that explicitely closes all the open channels.

src/Main/fg_io.cxx
src/Main/fg_io.hxx
src/Main/keyboard.cxx
src/Main/main.cxx

index b3304d651bbbce61f1edb333a1bfafc3bdea8c2c..f57dac4868c9c7a62027e2717c3dff3b31ee8d77 100644 (file)
@@ -210,7 +210,8 @@ void fgIOInit() {
            p->open();
            global_io_list.push_back( p );
            if ( !p->is_enabled() ) {
-               FG_LOG( FG_IO, FG_INFO, "I/O Channel config failed." );
+               FG_LOG( FG_IO, FG_ALERT, "I/O Channel config failed." );
+               exit(-1);
            }
        } else {
            FG_LOG( FG_IO, FG_INFO, "I/O Channel parse failed." );
@@ -253,3 +254,20 @@ void fgIOProcess() {
        }
     }
 }
+
+
+// shutdown all I/O connections
+void fgIOShutdownAll() {
+    FGProtocol *p;
+
+    // cout << "processing I/O channels" << endl;
+
+    for ( int i = 0; i < (int)global_io_list.size(); ++i ) {
+       // cout << "  channel = " << i << endl;
+       p = global_io_list[i];
+
+       if ( p->is_enabled() ) {
+           p->close();
+       }
+    }
+}
index 6f7f55cb19c855de0d17593bdc45802ac9215999..0550fdb022ad9ba8a376df584b5b099acd0fe6ed 100644 (file)
@@ -36,4 +36,8 @@ void fgIOInit();
 void fgIOProcess();
 
 
+// shutdown all I/O connections
+void fgIOShutdownAll();
+
+
 #endif // _FG_IO_HXX
index 69d940a1aafbdd684ea1c36e911ebc89316aa181..ba6e96092ce8baa43a203a9520cf24ae79f25b4b 100644 (file)
@@ -399,7 +399,7 @@ void GLUTkey(unsigned char k, int x, int y) {
            //   fclose( fg_DebugOutput );
            // }
            FG_LOG( FG_INPUT, FG_ALERT, 
-                   "Program exiting normally at user request." );
+                   "Program exit requested." );
            ConfirmExitDialog();
            return;
        }
index 803462fd7ae37a85382ffe78c9599b3de0b924d0..c0d33fe4e32b68469f7b0448b9a4816cb99fbe44 100644 (file)
@@ -962,7 +962,8 @@ static void fgMainLoop( void ) {
 
            double rpm_factor = cur_fdm_state->get_engine(0)->get_RPM() /
                2500.0;
-           cout << "rpm = " << cur_fdm_state->get_engine(0)->get_RPM() << endl;
+           // cout << "rpm = " << cur_fdm_state->get_engine(0)->get_RPM()
+           //      << endl;
 
            double pitch = 0.3 + rpm_factor * 3.0;
        
@@ -970,19 +971,19 @@ static void fgMainLoop( void ) {
            // and sounds bad to boot.  :-)
            if (pitch < 0.7) { pitch = 0.7; }
            if (pitch > 5.0) { pitch = 5.0; }
-           cout << "pitch = " << pitch << endl;
+           // cout << "pitch = " << pitch << endl;
 
            double mp_factor =
                cur_fdm_state->get_engine(0)->get_Manifold_Pressure() / 28;
-           cout << "mp = " 
-                << cur_fdm_state->get_engine(0)->get_Manifold_Pressure()
-                << endl;
+           // cout << "mp = " 
+           //      << cur_fdm_state->get_engine(0)->get_Manifold_Pressure()
+           //      << endl;
 
            double volume = mp_factor;
 
            if ( volume < 0.3 ) { volume = 0.3; }
            if ( volume > 2.0 ) { volume = 2.0; }
-           cout << "volume = " << volume << endl;
+           // cout << "volume = " << volume << endl;
 
            pitch_envelope.setStep  ( 0, 0.01, pitch );
            volume_envelope.setStep ( 0, 0.01, volume );