]> git.mxchange.org Git - flightgear.git/commitdiff
Fix up simulator freeze functionality.
authorcurt <curt>
Sat, 8 Jul 2000 06:29:19 +0000 (06:29 +0000)
committercurt <curt>
Sat, 8 Jul 2000 06:29:19 +0000 (06:29 +0000)
src/GUI/gui.cxx
src/Main/fg_init.cxx
src/Main/globals.hxx
src/Main/keyboard.cxx
src/Main/main.cxx
src/Main/options.cxx
src/Main/options.hxx

index c6e227ad677f9ac77c9f6d2faccce497db493a4a..904321d4b951cb12018b8ee6e9de69540a304411 100644 (file)
 #include <Cockpit/panel.hxx>
 #include <Controls/controls.hxx>
 #include <FDM/flight.hxx>
-#include <Main/options.hxx>
+#include <Main/bfi.hxx>
 #include <Main/fg_init.hxx>
+#include <Main/globals.hxx>
+#include <Main/options.hxx>
 #include <Main/views.hxx>
 #include <Main/save.hxx>
-#include <Main/bfi.hxx>
 #ifdef FG_NETWORK_OLK
 #include <NetworkOLK/network.h>
 #endif
@@ -669,16 +670,21 @@ void mkDialog (const char *txt)
 // Repair any damage done to the Panel by other Gui Items
 void guiFixPanel( void )
 {
-    int toggle_pause;
+#if 0 // this function does nothing anyway
+    bool freeze = globals->get_freeze();
 
     if ( current_options.get_panel_status() ) {
         // FGView *v = &current_view;
-        if( (toggle_pause = !current_options.get_pause()) )
-            current_options.toggle_pause();
+        if( !freeze )
+            globals->set_freeze( true );
 
-        if(toggle_pause)
-            current_options.toggle_pause();
+       // we must have some something here at some point but this
+       // function does nothing now.
+
+        if( !freeze )
+            globals->set_freeze( false );
     }
+#endif
 }
 
 // Toggle the Menu and Mouse display state
@@ -1029,9 +1035,9 @@ void AptDialog_OK (puObject *)
 
     FGAirport a;
     
-    int PauseMode = current_options.get_pause();
-    if(!PauseMode)
-        current_options.toggle_pause();
+    int freeze = globals->get_freeze();
+    if(!freeze)
+        globals->set_freeze( true );
 
     char *s;
     AptDialogInput->getValue(&s);
@@ -1058,8 +1064,8 @@ void AptDialog_OK (puObject *)
             mkDialog(AptId.c_str());
         }
     }
-    if( PauseMode != current_options.get_pause() )
-        current_options.toggle_pause();
+    if(!freeze)
+        globals->set_freeze( false );
 }
 
 void AptDialog_Reset(puObject *)
@@ -1139,9 +1145,9 @@ void NetIdDialog_OK (puObject *)
 {
     string NetId;
     
-    int PauseMode = current_options.get_pause();
-    if(!PauseMode)
-        current_options.toggle_pause();
+    bool freeze = globals->get_freeze();
+    if(!freeze)
+        globals->set_freeze( true );
 /*  
    The following needs some cleanup because 
    "string options.NetId" and "char *net_callsign" 
@@ -1156,8 +1162,8 @@ void NetIdDialog_OK (puObject *)
 /* Entering a callsign indicates : user wants Net HUD Info */
     net_hud_display = 1;
 
-    if( PauseMode != current_options.get_pause() )
-        current_options.toggle_pause();
+    if(!freeze)
+        globals->set_freeze( false );
 }
 
 void NewCallSign(puObject *cb)
@@ -1257,15 +1263,16 @@ void NetFGDDialog_OK (puObject *)
 {
     char *NetFGD;    
 
-    int PauseMode = current_options.get_pause();
-    if(!PauseMode) current_options.toggle_pause();
+    bool freeze = globals->get_freeze();
+    if(!freeze)
+        globals->set_freeze( true );
     NetFGDHostDialogInput->getValue( &NetFGD );
     strcpy( fgd_host, NetFGD);
     NetFGDPortLoDialogInput->getValue( (int *) &base_port );
     NetFGDPortHiDialogInput->getValue( (int *) &end_port );
     NetFGDDialog_Cancel( NULL );
-    if( PauseMode != current_options.get_pause() )
-        current_options.toggle_pause();
+    if(!freeze)
+        globals->set_freeze( false );
 }
 
 void NetFGDDialog_SCAN (puObject *)
@@ -1273,8 +1280,9 @@ void NetFGDDialog_SCAN (puObject *)
     char *NetFGD;
     int fgd_port;
     
-    int PauseMode = current_options.get_pause();
-    if(!PauseMode) current_options.toggle_pause();
+    bool freeze = globals->get_freeze();
+    if(!freeze)
+        globals->set_freeze( true );
 //    printf("Vor getvalue %s\n");
     NetFGDHostDialogInput->getValue( &NetFGD );
 //    printf("Vor strcpy %s\n", (char *) NetFGD);
@@ -1285,9 +1293,8 @@ void NetFGDDialog_SCAN (puObject *)
                  base_port, end_port);
     net_resolv_fgd(fgd_host);
     printf("Resolve : %d\n", net_r);
-    if( PauseMode != current_options.get_pause() ) {
-       current_options.toggle_pause();
-    }
+    if(!freeze)
+        globals->set_freeze( false );
     if ( net_r == 0 ) {
       fgd_port = 10000;
       strcpy( fgd_name, "");
index adb7877e964accda5a0f9e9749b7975ceca2fdfa..3cb462ec2a688ce4d49ef859b19b8d5176d35609 100644 (file)
@@ -91,6 +91,7 @@
 
 #include "fg_init.hxx"
 #include "fg_io.hxx"
+#include "globals.hxx"
 #include "options.hxx"
 #include "views.hxx"
 #include "bfi.hxx"
@@ -592,10 +593,9 @@ bool fgInitSubsystems( void ) {
 
 void fgReInitSubsystems( void )
 {
-    int toggle_pause = current_options.get_pause();
-    
-    if( !toggle_pause )
-        current_options.toggle_pause();
+    bool freeze = globals->get_freeze();
+    if( !freeze )
+        globals->set_freeze( true );
     
     fgInitPosition();
     if( global_tile_mgr.init() ) {
@@ -682,6 +682,6 @@ void fgReInitSubsystems( void )
     controls.reset_all();
     current_autopilot->reset();
 
-    if( !toggle_pause )
-        current_options.toggle_pause();
+    if( !freeze )
+        globals->set_freeze( false );
 }
index bc225f998a19de4647ce11b137cd7c1c9097e055..9c2f59902bd8935de4a8aeaf8053b29c7926206b 100644 (file)
@@ -55,8 +55,8 @@ public:
     FGGlobals();
     ~FGGlobals();
 
-    inline bool get_frozen() const { return freeze; }
-    inline void toggle_frozen() { freeze = !freeze; }
+    inline bool get_freeze() const { return freeze; }
+    inline void set_freeze( bool f ) { freeze = f; }
 
     inline long int get_warp() const { return warp; }
     inline void set_warp( long int w ) { warp = w; }
index 3171b28d776385f8219c26af70efa2b9e2647d45..ddf52d44b8d32f9012fafd63f07c4ca6fd80369f 100644 (file)
@@ -342,7 +342,7 @@ void GLUTkey(unsigned char k, int x, int y) {
            fgUpdateSkyAndLightingParams();
            return;
        case 112: // p key
-           current_options.toggle_pause();
+           globals->set_freeze( ! globals->get_freeze() );
 
            {
                FGBucket p( f->get_Longitude() * RAD_TO_DEG,
@@ -471,10 +471,10 @@ void GLUTspecialkey(int k, int x, int y) {
        switch (k) {
        case GLUT_KEY_F2: // F2 Reload Tile Cache...
            {
-               int toggle_pause;
+               bool freeze;
                FG_LOG(FG_INPUT, FG_INFO, "ReIniting TileCache");
-               if( (toggle_pause = !current_options.get_pause()) )
-                   current_options.toggle_pause();
+               if ( !freeze ) 
+                   globals->set_freeze( true );
                BusyCursor(0);
                if( global_tile_mgr.init() ) {
                    // Load the local scenery data
@@ -486,8 +486,8 @@ void GLUTspecialkey(int k, int x, int y) {
                    exit(-1);
                }
                BusyCursor(1);
-               if(toggle_pause)
-                   current_options.toggle_pause();
+               if ( !freeze )
+                  globals->set_freeze( false );
                return;
            }
        case GLUT_KEY_F3: // F3 Take a screen shot
index 179b7beb8cf27ff8bb002a99db1e3a52d57d3c83..af66a3b944e8c455e74c5b1f79f2955edb70332d 100644 (file)
@@ -615,7 +615,7 @@ void fgUpdateTimeDepCalcs(int multi_loop, int remainder) {
        multi_loop = 1;
     }
 
-    if ( !current_options.get_pause() ) {
+    if ( !globals->get_freeze() ) {
        // run Autopilot system
        current_autopilot->run();
 
index 15f4851c28207e791eafbc8a65b9a38b1a90d1ff..f8bc50070dcaeec1d46a41be25c3f72da787d967 100644 (file)
@@ -156,7 +156,6 @@ fgOPTIONS::fgOPTIONS() :
     splash_screen(1),
     intro_music(1),
     mouse_pointer(0),
-    pause(0),
     control_mode(FG_JOYSTICK),
     auto_coordination(FG_AUTO_COORD_NOT_SPECIFIED),
 
@@ -232,8 +231,10 @@ fgOPTIONS::fgOPTIONS() :
 void 
 fgOPTIONS::toggle_panel() {
     
-    if( !pause )
-        toggle_pause();
+    bool freeze = globals->get_freeze();
+
+    if( !freeze )
+        globals->set_freeze(true);
     
     if( panel_status ) {
        panel_status = false;
@@ -252,8 +253,8 @@ fgOPTIONS::toggle_panel() {
     // fgReshape( xsize, ysize);
     fgReshape( current_view.get_winWidth(), current_view.get_winHeight() );
 
-    if( !pause )
-        toggle_pause();
+    if( !freeze )
+        globals->set_freeze( false );
 }
 
 double
@@ -594,10 +595,10 @@ int fgOPTIONS::parse_option( const string& arg ) {
        mouse_pointer = 1;
     } else if ( arg == "--enable-mouse-pointer" ) {
        mouse_pointer = 2;
-    } else if ( arg == "--disable-pause" ) {
-       pause = false;  
-    } else if ( arg == "--enable-pause" ) {
-       pause = true;   
+    } else if ( arg == "--disable-freeze" ) {
+       globals->set_freeze( false );
+    } else if ( arg == "--enable-freeze" ) {
+       globals->set_freeze( true );
     } else if ( arg == "--disable-anti-alias-hud" ) {
        anti_alias_hud = false; 
     } else if ( arg == "--enable-anti-alias-hud" ) {
@@ -916,8 +917,8 @@ void fgOPTIONS::usage ( void ) {
     cout << "\t--enable-mouse-pointer:  enable extra mouse pointer (i.e. for"
         << endl;
     cout << "\t\tfull screen voodoo/voodoo-II based cards.)" << endl;
-    cout << "\t--disable-pause:  start out in an active state" << endl;
-    cout << "\t--enable-pause:  start out in a paused state" << endl;
+    cout << "\t--disable-freeze:  start out in an running state" << endl;
+    cout << "\t--enable-freeze:  start out in a frozen state" << endl;
     cout << "\t--control=mode:  primary control mode " 
         << "(joystick, keyboard, mouse)" << endl;
     cout << endl;
index 185f89b69af03f71249dde4360f8d92ac008bd56..09e2d87b5056377e02dd03758509e454e88d2524 100644 (file)
@@ -147,7 +147,6 @@ private:
     bool splash_screen; // show splash screen
     bool intro_music;   // play introductory music
     int mouse_pointer;  // show mouse pointer
-    bool pause;         // pause intially enabled/disabled
     fgControlMode control_mode; // primary control mode
     fgAutoCoordMode auto_coordination; // enable auto coordination
 
@@ -242,7 +241,6 @@ public:
     inline bool get_splash_screen() const { return splash_screen; }
     inline bool get_intro_music() const { return intro_music; }
     inline int get_mouse_pointer() const { return mouse_pointer; }
-    inline bool get_pause() const { return pause; }
     inline bool get_anti_alias_hud() const { return anti_alias_hud; }
     inline fgControlMode get_control_mode() const { return control_mode; }
     inline void set_control_mode( fgControlMode mode ) { control_mode = mode; }
@@ -312,8 +310,6 @@ public:
     inline void set_splash_screen (bool value) { splash_screen = value; }
     inline void set_intro_music (bool value) { intro_music = value; }
     inline void set_mouse_pointer (int value) { mouse_pointer = value; }
-    inline void set_pause (bool value) { pause = value; }
-    inline void toggle_pause () { pause = !pause; }
     inline void set_anti_alias_hud (bool value) { anti_alias_hud = value; }
     inline void set_hud_status( bool status ) { hud_status = status; }
     inline void set_sound (bool value) { sound = value; }