]> git.mxchange.org Git - flightgear.git/commitdiff
Structural work (init + shutdown) for new reset system.
authorJames Turner <zakalawe@mac.com>
Sat, 16 Nov 2013 12:10:32 +0000 (12:10 +0000)
committerJames Turner <zakalawe@mac.com>
Tue, 19 Nov 2013 17:38:51 +0000 (17:38 +0000)
The new approach is still work in progress (compile time option) and
non-functional, existing reset still works.

src/Main/fg_init.cxx
src/Main/fg_init.hxx
src/Main/globals.cxx
src/Main/globals.hxx
src/Main/main.cxx
src/Main/main.hxx
src/Viewer/fgviewer.cxx

index ef6f637f8ec2a1e9172cada30804fe62b4dfe94c..d131d1e9b1b04d9b166470199f54552a91ed44ad 100644 (file)
 #endif
 
 #include <string>
+
 #include <boost/algorithm/string/compare.hpp>
 #include <boost/algorithm/string/predicate.hpp>
 
+#include <osgViewer/Viewer>
+
 #include <simgear/constants.h>
 #include <simgear/debug/logstream.hxx>
 #include <simgear/structure/exception.hxx>
@@ -57,7 +60,9 @@
 #include <simgear/misc/sgstream.hxx>
 #include <simgear/misc/strutils.hxx>
 #include <simgear/props/props_io.hxx>
+#include <simgear/scene/tsync/terrasync.hxx>
 
+#include <simgear/scene/model/modellib.hxx>
 #include <simgear/scene/material/matlib.hxx>
 #include <simgear/scene/model/particles.hxx>
 #include <simgear/scene/tsync/terrasync.hxx>
 #include <Sound/soundmanager.hxx>
 #include <Systems/system_mgr.hxx>
 #include <Time/light.hxx>
+#include <Time/TimeManager.hxx>
+
 #include <Traffic/TrafficMgr.hxx>
 #include <MultiPlayer/multiplaymgr.hxx>
 #include <FDM/fdm_shell.hxx>
 #include <Environment/environment_mgr.hxx>
 #include <Viewer/renderer.hxx>
 #include <Viewer/viewmgr.hxx>
+#include <Viewer/FGEventHandler.hxx>
 #include <Navaids/NavDataCache.hxx>
 #include <Instrumentation/HUD/HUD.hxx>
 #include <Cockpit/cockpitDisplayManager.hxx>
 #include <Network/HTTPClient.hxx>
 #include <Network/fgcom.hxx>
 
+#include <Viewer/CameraGroup.hxx>
+
 #include "fg_init.hxx"
 #include "fg_io.hxx"
 #include "fg_commands.hxx"
 #include <GUI/CocoaHelpers.h> // for Mac impl of platformDefaultDataPath()
 #endif
 
+//#define NEW_RESET 1
+
 using std::string;
 using std::endl;
 using std::cerr;
 using std::cout;
 using namespace boost::algorithm;
 
+extern osg::ref_ptr<osgViewer::Viewer> viewer;
 
 // Return the current base package version
 string fgBasePackageVersion() {
@@ -413,7 +426,7 @@ bool fgInitHome()
 }
 
 // Read in configuration (file and command line)
-int fgInitConfig ( int argc, char **argv )
+int fgInitConfig ( int argc, char **argv, bool reinit )
 {
     SGPath dataPath = globals->get_fg_home();
     
@@ -432,7 +445,10 @@ int fgInitConfig ( int argc, char **argv )
   
     fgSetDefaults();
     flightgear::Options* options = flightgear::Options::sharedInstance();
-    options->init(argc, argv, dataPath);
+    if (!reinit) {
+        options->init(argc, argv, dataPath);
+    }
+    
     bool loadDefaults = flightgear::Options::sharedInstance()->shouldLoadDefaultConfig();
     if (loadDefaults) {
       // Read global preferences from $FG_ROOT/preferences.xml
@@ -552,7 +568,7 @@ void fgOutputSettings()
 // initialization routines.  If you are adding a subsystem to flight
 // gear, its initialization call should located in this routine.
 // Returns non-zero if a problem encountered.
-void fgCreateSubsystems() {
+void fgCreateSubsystems(bool duringReset) {
 
     SG_LOG( SG_GENERAL, SG_INFO, "Creating Subsystems");
     SG_LOG( SG_GENERAL, SG_INFO, "========== ==========");
@@ -599,13 +615,15 @@ void fgCreateSubsystems() {
     // Initialize the material property subsystem.
     ////////////////////////////////////////////////////////////////////
 
-    SGPath mpath( globals->get_fg_root() );
-    mpath.append( fgGetString("/sim/rendering/materials-file") );
-    if ( ! globals->get_matlib()->load(globals->get_fg_root(), mpath.str(),
-            globals->get_props()) ) {
-        throw sg_io_exception("Error loading materials file", mpath);
+    if (!duringReset) {
+        SGPath mpath( globals->get_fg_root() );
+        mpath.append( fgGetString("/sim/rendering/materials-file") );
+        if ( ! globals->get_matlib()->load(globals->get_fg_root(), mpath.str(),
+                globals->get_props()) ) {
+           throw sg_io_exception("Error loading materials file", mpath);
+        }
     }
-
+    
     globals->add_subsystem( "http", new FGHTTPClient );
     
     ////////////////////////////////////////////////////////////////////
@@ -756,10 +774,11 @@ void fgCreateSubsystems() {
     // Initialize the lighting subsystem.
     ////////////////////////////////////////////////////////////////////
 
-    globals->add_subsystem("lighting", new FGLight, SGSubsystemMgr::DISPLAY);
-    
     // ordering here is important : Nasal (via events), then models, then views
-    globals->add_subsystem("events", globals->get_event_mgr(), SGSubsystemMgr::DISPLAY);
+    if (!duringReset) {
+        globals->add_subsystem("lighting", new FGLight, SGSubsystemMgr::DISPLAY);
+        globals->add_subsystem("events", globals->get_event_mgr(), SGSubsystemMgr::DISPLAY);
+    }
 
     globals->add_subsystem("aircraft-model", new FGAircraftModel, SGSubsystemMgr::DISPLAY);
     globals->add_subsystem("model-manager", new FGModelMgr, SGSubsystemMgr::DISPLAY);
@@ -829,6 +848,11 @@ void fgPostInitSubsystems()
 // Reset: this is what the 'reset' command (and hence, GUI) is attached to
 void fgReInitSubsystems()
 {
+#ifdef NEW_RESET
+    fgResetIdleState();
+    return;
+#endif
+    
     SGPropertyNode *master_freeze = fgGetNode("/sim/freeze/master");
 
     SG_LOG( SG_GENERAL, SG_INFO, "fgReInitSubsystems()");
@@ -905,4 +929,87 @@ void fgReInitSubsystems()
     fgSetBool("/sim/sceneryloaded",false);
 }
 
+void fgStartNewReset()
+{
+    globals->saveInitialState();
+    
+    fgSetBool("/sim/signals/reinit", true);
+    fgSetBool("/sim/freeze/master", true);
+    
+    SGSubsystemMgr* subsystemManger = globals->get_subsystem_mgr();
+    subsystemManger->shutdown();
+    subsystemManger->unbind();
+    
+    // remove them all (with some exceptions?)
+    for (int g=0; g<SGSubsystemMgr::MAX_GROUPS; ++g) {
+        SGSubsystemGroup* grp = subsystemManger->get_group(static_cast<SGSubsystemMgr::GroupType>(g));
+        const string_list& names(grp->member_names());
+        string_list::const_iterator it;
+        for (it = names.begin(); it != names.end(); ++it) {
+            if ((*it == "time") || (*it == "terrasync") || (*it == "events")
+                || (*it == "lighting"))
+            {
+                continue;
+            }
+            
+            try {
+                subsystemManger->remove(it->c_str());
+            } catch (std::exception& e) {
+                SG_LOG(SG_GENERAL, SG_INFO, "caught std::exception shutting down:" << *it);
+            } catch (...) {
+                SG_LOG(SG_GENERAL, SG_INFO, "caught generic exception shutting down:" << *it);
+            }
+            
+            // don't delete here, dropping the ref should be sufficient
+        }
+    } // of top-level groups iteration
+    
+    // order is important here since tile-manager shutdown needs to
+    // access the scenery object
+    globals->set_tile_mgr(NULL);
+    globals->set_scenery(NULL);
+    flightgear::CameraGroup::setDefault(NULL);
+    
+    FGRenderer* render = globals->get_renderer();
+    // don't cancel the pager until after shutdown, since AIModels (and
+    // potentially others) can queue delete requests on the pager.
+    render->getViewer()->getDatabasePager()->cancel();
+    
+    // preserve the event handler; re-creating it would entail fixing the
+    // idle handler
+    osg::ref_ptr<flightgear::FGEventHandler> eventHandler = render->getEventHandler();
+    
+    globals->set_renderer(NULL);
+    simgear::SGModelLib::resetPropertyRoot();
+    
+    globals->resetPropertyRoot();
+    globals->restoreInitialState();
+    
+    render = new FGRenderer;
+    render->setEventHandler(eventHandler);
+    globals->set_renderer(render);
+    render->init();
+    render->setViewer(viewer.get());
+    viewer->getDatabasePager()->setUpThreads(1, 1);
+    render->splashinit();
+    
+    flightgear::CameraGroup::buildDefaultGroup(viewer.get());
+
+    fgOSResetProperties();
+    fgInitConfig(0, NULL, true);
+    
+// init some things manually
+// which do not follow the regular init pattern
+    
+    globals->get_event_mgr()->init();
+    globals->get_event_mgr()->setRealtimeProperty(fgGetNode("/sim/time/delta-realtime-sec", true));
+    
+// terra-sync needs the property tree root, pass it back in
+    simgear::SGTerraSync* terra_sync = static_cast<simgear::SGTerraSync*>(subsystemManger->get_subsystem("terrasync"));
+    terra_sync->setRoot(globals->get_props());
+
+    fgSetBool("/sim/signals/reinit", false);
+    fgSetBool("/sim/freeze/master", false);
+    fgSetBool("/sim/sceneryloaded",false);
+}
 
index b26af11f26a553928faae94378b1b6773395507d..b0399099a43ff94d921632f9f824d72acb1a6696 100644 (file)
@@ -37,7 +37,7 @@ std::string fgBasePackageVersion();
 bool fgInitHome();
 
 // Read in configuration (file and command line)
-int fgInitConfig ( int argc, char **argv );
+int fgInitConfig ( int argc, char **argv, bool reinit );
 
 
 // log various settings / configuration state
@@ -55,7 +55,7 @@ bool fgInitGeneral ();
 
 
 // Create all the subsystems needed by the sim
-void fgCreateSubsystems();
+void fgCreateSubsystems(bool duringReset);
 
 // called after the subsystems have been bound and initialised,
 // to peform final init
@@ -64,6 +64,9 @@ void fgPostInitSubsystems();
 // Reset: this is what the 'reset' command (and hence, GUI) is attached to
 void fgReInitSubsystems();
 
+
+void fgStartNewReset();
+
 #endif // _FG_INIT_HXX
 
 
index 163e26180c78e9d3123e431d38033c685d7cb028..909c83fb662157b84911850e2d10e8442968824f 100644 (file)
@@ -127,14 +127,12 @@ public:
 ////////////////////////////////////////////////////////////////////////
 
 // global global :-)
-FGGlobals *globals;
+FGGlobals *globals = NULL;
 
 
 // Constructor
 FGGlobals::FGGlobals() :
-    props( new SGPropertyNode ),
     initial_state( NULL ),
-    locale( new FGLocale(props) ),
     renderer( new FGRenderer ),
     subsystem_mgr( new SGSubsystemMgr ),
     event_mgr( new SGEventMgr ),
@@ -151,27 +149,35 @@ FGGlobals::FGGlobals() :
     commands( SGCommandMgr::instance() ),
     channel_options_list( NULL ),
     initial_waypoints( NULL ),
-    scenery( NULL ),
-    tile_mgr( NULL ),
     fontcache ( new FGFontCache ),
     channellist( NULL ),
     haveUserSettings(false)
 {
-  simgear::ResourceManager::instance()->addProvider(new AircraftResourceProvider);
-  simgear::ResourceManager::instance()->addProvider(new CurrentAircraftDirProvider);
-  simgear::PropertyObjectBase::setDefaultRoot(props);
-  
-  positionLon = props->getNode("position/longitude-deg", true);
-  positionLat = props->getNode("position/latitude-deg", true);
-  positionAlt = props->getNode("position/altitude-ft", true);
-  
-  viewLon = props->getNode("sim/current-view/viewer-lon-deg", true);
-  viewLat = props->getNode("sim/current-view/viewer-lat-deg", true);
-  viewAlt = props->getNode("sim/current-view/viewer-elev-ft", true);
-  
-  orientPitch = props->getNode("orientation/pitch-deg", true);
-  orientHeading = props->getNode("orientation/heading-deg", true);
-  orientRoll = props->getNode("orientation/roll-deg", true);
+    SGPropertyNode* root = new SGPropertyNode;
+    props = SGPropertyNode_ptr(root);
+    locale = new FGLocale(props);
+    
+    simgear::ResourceManager::instance()->addProvider(new AircraftResourceProvider);
+    simgear::ResourceManager::instance()->addProvider(new CurrentAircraftDirProvider);
+    initProperties();
+}
+
+void FGGlobals::initProperties()
+{
+    simgear::PropertyObjectBase::setDefaultRoot(props);
+    
+    positionLon = props->getNode("position/longitude-deg", true);
+    positionLat = props->getNode("position/latitude-deg", true);
+    positionAlt = props->getNode("position/altitude-ft", true);
+    
+    viewLon = props->getNode("sim/current-view/viewer-lon-deg", true);
+    viewLat = props->getNode("sim/current-view/viewer-lat-deg", true);
+    viewAlt = props->getNode("sim/current-view/viewer-elev-ft", true);
+    
+    orientPitch = props->getNode("orientation/pitch-deg", true);
+    orientHeading = props->getNode("orientation/heading-deg", true);
+    orientRoll = props->getNode("orientation/roll-deg", true);
+
 }
 
 // Destructor
@@ -186,35 +192,35 @@ FGGlobals::~FGGlobals()
     // deallocation of AIModel objects. To ensure we can safely
     // shut down all subsystems, make sure we take down the 
     // AIModels system first.
-    SGSubsystem* ai = globals->get_subsystem("ai-model");
+    SGSubsystemRef ai = subsystem_mgr->get_subsystem("ai-model");
     if (ai) {
-        ai->unbind();
         subsystem_mgr->remove("ai-model");
+        ai->unbind();
+        ai.clear(); // ensure AI is deleted now, not at end of this method
     }
+    
+    subsystem_mgr->shutdown();
+    subsystem_mgr->unbind();    
 
     subsystem_mgr->remove("aircraft-model");
     subsystem_mgr->remove("tile-manager");
     subsystem_mgr->remove("model-manager");
-    
-    subsystem_mgr->shutdown();
-    subsystem_mgr->unbind();
+    _tile_mgr.clear();
+
+    // renderer touches subsystems during its destruction
+    set_renderer(NULL);
+    _scenery.clear();
+
     delete subsystem_mgr;
     subsystem_mgr = NULL; // important so ::get_subsystem returns NULL 
-    
-    delete renderer;
-    renderer = NULL;
-    
+
     delete time_params;
     delete matlib;
     delete route_mgr;
-
     delete ATIS_mgr;
-
     delete channel_options_list;
     delete initial_waypoints;
-    delete scenery;
     delete fontcache;
-
     delete channellist;
 
     simgear::PropertyObjectBase::setDefaultRoot(NULL);
@@ -223,7 +229,7 @@ FGGlobals::~FGGlobals()
     delete locale;
     locale = NULL;
     
-    delete props;
+    props.clear();
 }
 
 // set the fg_root path
@@ -412,6 +418,16 @@ FGGlobals::get_renderer () const
    return renderer;
 }
 
+void FGGlobals::set_renderer(FGRenderer *render)
+{
+    if (render == renderer) {
+        return;
+    }
+    
+    delete renderer;
+    renderer = render;
+}
+
 SGSubsystemMgr *
 FGGlobals::get_subsystem_mgr () const
 {
@@ -487,6 +503,39 @@ FGGlobals::get_view_position_cart() const
   return SGVec3d::fromGeod(get_view_position());
 }
 
+static void treeDumpRefCounts(int depth, SGPropertyNode* nd)
+{
+    for (int i=0; i<nd->nChildren(); ++i) {
+        SGPropertyNode* cp = nd->getChild(i);
+        if (SGReferenced::count(cp) > 1) {
+            SG_LOG(SG_GENERAL, SG_INFO, "\t" << cp->getPath() << " refcount:" << SGReferenced::count(cp));
+        }
+        
+        treeDumpRefCounts(depth + 1, cp);
+    }
+}
+
+void
+FGGlobals::resetPropertyRoot()
+{
+    delete locale;
+    
+#if DEBUG_RESET
+    SG_LOG(SG_GENERAL, SG_INFO, "root props refcount:" << props.getNumRefs());
+    treeDumpRefCounts(0, props);
+#endif
+    props = new SGPropertyNode;
+    initProperties();
+    locale = new FGLocale(props);
+    
+    // remove /sim/fg-root before writing to prevent hijacking
+    SGPropertyNode *n = props->getNode("/sim", true);
+    n->removeChild("fg-root", 0, false);
+    n = n->getChild("fg-root", 0, true);
+    n->setStringValue(fg_root.c_str());
+    n->setAttribute(SGPropertyNode::WRITE, false);
+}
+
 // Save the current state as the initial state.
 void
 FGGlobals::saveInitialState ()
@@ -619,4 +668,24 @@ void FGGlobals::set_warp_delta( long int d )
   fgSetInt("/sim/time/warp-delta", d);
 }
 
+FGScenery* FGGlobals::get_scenery () const
+{
+    return _scenery.get();
+}
+
+void FGGlobals::set_scenery ( FGScenery *s )
+{
+    _scenery = s;
+}
+
+FGTileMgr* FGGlobals::get_tile_mgr () const
+{
+    return _tile_mgr.get();
+}
+
+void FGGlobals::set_tile_mgr ( FGTileMgr *t )
+{
+    _tile_mgr = t;
+}
+
 // end of globals.cxx
index 7ed60b9c3f1e7907e5f33b3f1dfdd72a846c617e..f6cc5bfd99bdfedb960123ef5cb9154a9f23ccad 100644 (file)
@@ -138,10 +138,10 @@ private:
     string_list *initial_waypoints;
 
     // FlightGear scenery manager
-    FGScenery *scenery;
+    SGSharedPtr<FGScenery> _scenery;
 
     // Tile manager
-    FGTileMgr *tile_mgr;
+    SGSharedPtr<FGTileMgr> _tile_mgr;
 
     FGFontCache *fontcache;
 
@@ -156,13 +156,19 @@ private:
     SGPropertyNode_ptr positionLon, positionLat, positionAlt;
     SGPropertyNode_ptr viewLon, viewLat, viewAlt;
     SGPropertyNode_ptr orientHeading, orientPitch, orientRoll;
+    
+    /**
+     * helper to initialise standard properties on a new property tree
+     */
+    void initProperties();
 public:
 
     FGGlobals();
     virtual ~FGGlobals();
 
     virtual FGRenderer *get_renderer () const;
-
+    void set_renderer(FGRenderer* render);
+    
     virtual SGSubsystemMgr *get_subsystem_mgr () const;
 
     virtual SGSubsystem *get_subsystem (const char * name);
@@ -268,8 +274,13 @@ public:
     FGViewer *get_current_view() const;
 
     inline SGPropertyNode *get_props () { return props; }
-    inline void set_props( SGPropertyNode *n ) { props = n; }
 
+    /**
+     * @brief reset the property tree to new, empty tree. Ensure all
+     * subsystems are shutdown and unbound before call this.
+     */
+    void resetPropertyRoot();
+    
     inline FGLocale* get_locale () { return locale; }
 
     inline SGCommandMgr *get_commands () { return commands; }
@@ -299,11 +310,11 @@ public:
         initial_waypoints = list;
     }
 
-    inline FGScenery * get_scenery () const { return scenery; }
-    inline void set_scenery ( FGScenery *s ) { scenery = s; }
+    FGScenery * get_scenery () const;
+    void set_scenery ( FGScenery *s );
 
-    inline FGTileMgr * get_tile_mgr () const { return tile_mgr; }
-    inline void set_tile_mgr ( FGTileMgr *t ) { tile_mgr = t; }
+    FGTileMgr * get_tile_mgr () const;
+    void set_tile_mgr ( FGTileMgr *t );
 
     inline FGFontCache *get_fontcache() const { return fontcache; }
   
index b5d9dfa67e85bcb13efe768fae31321f21c3cf7b..26701f8a07575472645e7bcb9a65720a80b56695 100644 (file)
@@ -145,12 +145,13 @@ static void registerMainLoop()
 // per pass) and once everything has been initialized fgMainLoop from
 // then on.
 
+static int idle_state = 0;
+
 static void fgIdleFunction ( void ) {
     // Specify our current idle function state.  This is used to run all
     // our initializations out of the idle callback so that we can get a
     // splash screen up and running right away.
-    static int idle_state = 0;
-  
+    
     if ( idle_state == 0 ) {
         if (guiInit())
         {
@@ -159,7 +160,6 @@ static void fgIdleFunction ( void ) {
         }
 
     } else if ( idle_state == 2 ) {
-
         initTerrasync();
         idle_state++;
         fgSplashProgress("loading-nav-dat");
@@ -175,15 +175,10 @@ static void fgIdleFunction ( void ) {
         }
       
     } else if ( idle_state == 4 ) {
-        idle_state+=2;
-        // based on the requested presets, calculate the true starting
-        // lon, lat
-        flightgear::initPosition();
-        flightgear::initTowerLocationListener();
+        idle_state++;
 
         TimeManager* t = new TimeManager;
         globals->add_subsystem("time", t, SGSubsystemMgr::INIT);
-        t->init(); // need to init now, not during initSubsystems
         
         // Do some quick general initializations
         if( !fgInitGeneral()) {
@@ -201,29 +196,34 @@ static void fgIdleFunction ( void ) {
         // Initialize the material manager
         ////////////////////////////////////////////////////////////////////
         globals->set_matlib( new SGMaterialLib );
-        simgear::SGModelLib::init(globals->get_fg_root(), globals->get_props());
         simgear::SGModelLib::setPanelFunc(FGPanelNode::load);
-
+    } else if (( idle_state == 5 ) || (idle_state == 2005)) {
+        idle_state+=2;
+        flightgear::initPosition();
+        flightgear::initTowerLocationListener();
+        
+        simgear::SGModelLib::init(globals->get_fg_root(), globals->get_props());
+        
+        TimeManager* timeManager = (TimeManager*) globals->get_subsystem("time");
+        timeManager->init();
+        
         ////////////////////////////////////////////////////////////////////
         // Initialize the TG scenery subsystem.
         ////////////////////////////////////////////////////////////////////
-
+        
         globals->set_scenery( new FGScenery );
         globals->get_scenery()->init();
         globals->get_scenery()->bind();
         globals->set_tile_mgr( new FGTileMgr );
-
-        fgSplashProgress("loading-aircraft");
-
-    } else if ( idle_state == 6 ) {
-        idle_state++;
+        
         fgSplashProgress("creating-subsystems");
-
-    } else if ( idle_state == 7 ) {
-        idle_state++;
+    } else if (( idle_state == 7 ) || (idle_state == 2007)) {
+        bool isReset = (idle_state == 2007);
+        idle_state = 8; // from the next state on, reset & startup are identical
         SGTimeStamp st;
         st.stamp();
-        fgCreateSubsystems();
+        fgCreateSubsystems(isReset);
         SG_LOG(SG_GENERAL, SG_INFO, "Creating subsystems took:" << st.elapsedMSec());
         fgSplashProgress("binding-subsystems");
       
@@ -271,8 +271,20 @@ static void fgIdleFunction ( void ) {
         fgSetBool("sim/sceneryloaded", false);
         registerMainLoop();
     }
+    
+    if ( idle_state == 2000 ) {
+        fgStartNewReset();
+        idle_state = 2005;
+    }
+}
+
+void fgResetIdleState()
+{
+    idle_state = 2000;
+    fgRegisterIdleHandler( &fgIdleFunction );
 }
 
+
 static void upper_case_property(const char *name)
 {
     using namespace simgear;
@@ -369,7 +381,7 @@ int fgMainInit( int argc, char **argv ) {
     // Load the configuration parameters.  (Command line options
     // override config file options.  Config file options override
     // defaults.)
-    int configResult = fgInitConfig(argc, argv);
+    int configResult = fgInitConfig(argc, argv, false);
     if (configResult == flightgear::FG_OPTIONS_ERROR) {
         return EXIT_FAILURE;
     } else if (configResult == flightgear::FG_OPTIONS_EXIT) {
index 7cea8baaf4fe9d62f202e08cb0e693562c409755..8165aaddeb428618c833cf640c4fb80ad1cd802a 100644 (file)
@@ -23,6 +23,8 @@
 
 int fgMainInit( int argc, char **argv );
 
+void fgResetIdleState();
+
 extern std::string hostname;
 
 #endif
index 0e98613dd6033d1aa06f8632265fdba24d80bb6b..2d7af14955ee14a5b6283467098dcf843ea19d18 100644 (file)
@@ -171,7 +171,7 @@ fgviewerMain(int argc, char** argv)
 
     globals = new FGGlobals;
 
-    int configResult = fgInitConfig(arguments.argc(), arguments.argv());
+    int configResult = fgInitConfig(arguments.argc(), arguments.argv(), false);
     if (configResult == flightgear::FG_OPTIONS_ERROR) {
         return EXIT_FAILURE;
     } else if (configResult == flightgear::FG_OPTIONS_EXIT) {