]> git.mxchange.org Git - flightgear.git/blobdiff - src/GUI/apt_dlg.cxx
Viewer update from Jim Wilson:
[flightgear.git] / src / GUI / apt_dlg.cxx
index 970d40dea7149616653590d8bd64e8f7f63cb1c6..41d2e21c572a0114ec549acc1f9aec40ae753e54 100644 (file)
@@ -55,6 +55,8 @@ void AptDialog_OK (puObject *)
        = fgGetNode("/position/longitude-deg");
     static const SGPropertyNode *latitude
        = fgGetNode("/position/latitude-deg");
+    static const SGPropertyNode *master_freeze
+       = fgGetNode("/sim/freeze/master");
 
     SGPath path( globals->get_fg_root() );
     path.append( "Airports" );
@@ -63,9 +65,10 @@ void AptDialog_OK (puObject *)
 
     FGAirport a;
 
-    int freeze = globals->get_freeze();
-    if(!freeze)
-        globals->set_freeze( true );
+    bool freeze = master_freeze->getBoolValue();
+    if ( !freeze ) {
+        fgSetBool("/sim/freeze/master", true);
+    }
 
     char *s;
     AptDialogInput->getValue(&s);
@@ -82,38 +85,31 @@ void AptDialog_OK (puObject *)
                 << AptId );
 
         if ( airports.search( AptId, &a ) )
-            {
-               // unbind the current fdm state so property changes
-               // don't get lost when we subsequently delete this fdm
-               // and create a new one.
-               cur_fdm_state->unbind();
-
-                AptId = a.id.c_str();  /// NHV fix wrong case crash
-                fgSetString("/sim/startup/airport-id",  AptId.c_str() );
-                // fgSetDouble("/position/altitude-ft", -9999.0 );
-                // fgSetPosFromAirportID( AptId );
-                fgSetPosFromAirportIDandHdg( AptId, 
-                                             cur_fdm_state->get_Psi() *
-                                             SGD_RADIANS_TO_DEGREES);
-                BusyCursor(0);
-                fgReInitSubsystems();
-                // if ( global_tile_mgr.init() ) {
-                    // Load the local scenery data
-                    global_tile_mgr.update( longitude->getDoubleValue(),
-                                            longitude->getDoubleValue() );
-               // } else {
-                    // SG_LOG( SG_GENERAL, SG_ALERT, 
-                            // "Error in Tile Manager initialization!" );
-                    // exit(-1);
-                // }
-                BusyCursor(1);
-            } else {
-                AptId  += " not in database.";
-                mkDialog(AptId.c_str());
-            }
+        {
+            // unbind the current fdm state so property changes
+            // don't get lost when we subsequently delete this fdm
+            // and create a new one.
+            cur_fdm_state->unbind();
+        
+            AptId = a.id.c_str();  /// NHV fix wrong case crash
+            fgSetString("/sim/startup/airport-id",  AptId.c_str() );
+            // fgSetDouble("/position/altitude-ft", -9999.0 );
+            // fgSetPosFromAirportID( AptId );
+            fgSetPosFromAirportIDandHdg( AptId, 
+                                         cur_fdm_state->get_Psi() *
+                                         SGD_RADIANS_TO_DEGREES);
+            // BusyCursor(0);
+            fgReInitSubsystems();
+            global_tile_mgr.update( longitude->getDoubleValue(),
+                                    latitude->getDoubleValue() );
+            // BusyCursor(1);
+        } else {
+            AptId  += " not in database.";
+            mkDialog(AptId.c_str());
+        }
     }
     if ( !freeze ) {
-        globals->set_freeze( false );
+        fgSetBool("/sim/freeze/master", false);
     }
 }
 
@@ -121,7 +117,7 @@ void AptDialog_OK (puObject *)
 void AptDialog_Reset(puObject *)
 {
     //  strncpy( NewAirportId, fgGetString("/sim/startup/airport-id").c_str(), 16 );
-    sprintf( NewAirportId, "%s", fgGetString("/sim/startup/airport-id").c_str() );
+    sprintf( NewAirportId, "%s", fgGetString("/sim/startup/airport-id") );
     AptDialogInput->setValue ( NewAirportId );
     AptDialogInput->setCursor( 0 ) ;
 }
@@ -129,8 +125,8 @@ void AptDialog_Reset(puObject *)
 void NewAirport(puObject *cb)
 {
     //  strncpy( NewAirportId, fgGetString("/sim/startup/airport-id").c_str(), 16 );
-    sprintf( NewAirportId, "%s", fgGetString("/sim/startup/airport-id").c_str() );
-    // cout << "NewAirport " << NewAirportId << endl;
+    sprintf( NewAirportId, "%s", fgGetString("/sim/startup/airport-id") );
+    // cout << "NewAirport " << NewAirportId << endl;
     AptDialogInput->setValue( NewAirportId );
 
     FG_PUSH_PUI_DIALOG( AptDialog );
@@ -138,7 +134,7 @@ void NewAirport(puObject *cb)
 
 void NewAirportInit(void)
 {
-    sprintf( NewAirportId, "%s", fgGetString("/sim/startup/airport-id").c_str() );
+    sprintf( NewAirportId, "%s", fgGetString("/sim/startup/airport-id") );
     int len = 150
         - puGetDefaultLabelFont().getStringWidth( NewAirportLabel ) / 2;