]> git.mxchange.org Git - flightgear.git/blobdiff - src/GUI/gui_local.cxx
Don't restore initial screen geometry because there is nothing in fg_os* to resize...
[flightgear.git] / src / GUI / gui_local.cxx
index 1506577c54abaacce5b3b85934e75f1d23b6a00a..64318b62e149fa05670259a10cad78e15156cec4 100644 (file)
@@ -6,7 +6,6 @@
 #  include <windows.h>
 #endif
 
-#include <GL/glut.h>        // needed before pu.h
 #include <plib/pu.h>        // plib include
 
 #include <FDM/flight.hxx>
 #include <Main/globals.hxx>
 #include <Main/fg_init.hxx>
 #include <Main/fg_props.hxx>
+#include <Main/renderer.hxx>
 #include <Scenery/tilemgr.hxx>
 #include <Time/light.hxx>
 
 #include "gui.h"
 #include "trackball.h"
 
-// from main.cxx
-extern void fgReshape(int, int);
-
 // FOR MOUSE VIEW MODE
 // stashed trackball(_quat0, 0.0, 0.0, 0.0, 0.0);
 static float _quat0[4];
@@ -51,12 +48,16 @@ void initMouseQuat(void) {
 
 void reInit(puObject *cb)
 {
-    BusyCursor(0);
+    // BusyCursor(0);
     Quat0();
 
-    int freeze = globals->get_freeze();
-    if(!freeze)
-        globals->set_freeze( true );
+    static const SGPropertyNode *master_freeze
+       = fgGetNode("/sim/freeze/master");
+
+    bool freeze = master_freeze->getBoolValue();
+    if ( !freeze ) {
+        fgSetBool("/sim/freeze/master", true);
+    }
 
     cur_fdm_state->unbind();
 
@@ -69,27 +70,30 @@ void reInit(puObject *cb)
 
     globals->restoreInitialState();
 
-       // Unsuccessful KLUDGE to fix the 'every other time'
-       // problem when doing a 'reset' after a 'goto airport'
-       
-       // string AptId( fgGetString("/sim/startup/airport-id") );
-       // if( AptId.c_str() != "\0" )
-       //      fgSetPosFromAirportID( AptId );
-       
+    // update our position based on current presets
+    fgInitPosition();
+
+    // We don't know how to resize the window, so keep the last values 
+    //  for xsize and ysize, and don't use the one set initially
+    fgSetInt("/sim/startup/xsize",xsize);
+    fgSetInt("/sim/startup/ysize",ysize);
+
+    SGTime *t = globals->get_time_params();
+    delete t;
+    t = fgInitTime();
+    globals->set_time_params( t );
+
     fgReInitSubsystems();
 
-    // reduntant(fgReInitSubsystems) ?
-    global_tile_mgr.update( fgGetDouble("/position/longitude-deg"),
-                            fgGetDouble("/position/latitude-deg") );
-    
-    cur_light_params.Update();
+    globals->get_tile_mgr()->update( fgGetDouble("/environment/visibility-m") );
+    globals->get_renderer()->resize( xsize, ysize );
 
-    fgReshape( xsize, ysize );
+    fgSetBool("/sim/signals/reinit", true);
 
-    BusyCursor(1);
+    // BusyCursor(1);
     
     if ( !freeze ) {
-        globals->set_freeze( false );
+        fgSetBool("/sim/freeze/master", false);
     }
 }