]> git.mxchange.org Git - flightgear.git/commitdiff
Save/restore initial state removed.
authorJames Turner <zakalawe@mac.com>
Mon, 10 Mar 2014 17:29:28 +0000 (17:29 +0000)
committerJames Turner <zakalawe@mac.com>
Mon, 10 Mar 2014 17:29:28 +0000 (17:29 +0000)
src/Main/fg_init.cxx
src/Main/fg_props.cxx
src/Main/globals.cxx
src/Main/globals.hxx

index 6c5ca203c28a3c3491042e5ed9a297e14a89387d..d39f3ef615f9499056755ec69c78198dca6aaeaa 100644 (file)
@@ -857,10 +857,6 @@ void fgPostInitSubsystems()
     fgSetBool("/sim/initialized", true);
 
     SG_LOG( SG_GENERAL, SG_INFO, endl);
-
-                                // Save the initial state for future
-                                // reference.
-    globals->saveInitialState();
 }
 
 // re-position is a simplified version of the traditional (legacy)
index bf62711c8a0775ccbfe34aba47d34aedf9f2123d..a93529dffd182245cb24460b442b79a98f3da22e 100644 (file)
@@ -602,9 +602,7 @@ fgLoadFlight (std::istream &input)
   fgSetString("/sim/presets/speed-set", "UVW");
 
   copyProperties(&props, globals->get_props());
-  // When loading a flight, make it the
-  // new initial state.
-  globals->saveInitialState();
+
   return true;
 }
 
index 8ed71cbd50f9d48dc424359efaa0e57f64ec0950..2617067d26944a94296935bcfb8b4808a55ffcc0 100644 (file)
@@ -135,7 +135,6 @@ FGGlobals *globals = NULL;
 
 // Constructor
 FGGlobals::FGGlobals() :
-    initial_state( NULL ),
     renderer( new FGRenderer ),
     subsystem_mgr( new SGSubsystemMgr ),
     event_mgr( new SGEventMgr ),
@@ -603,31 +602,6 @@ FGGlobals::resetPropertyRoot()
     n->setAttribute(SGPropertyNode::WRITE, false);
 }
 
-// Save the current state as the initial state.
-void
-FGGlobals::saveInitialState ()
-{
-  initial_state = new SGPropertyNode();
-
-  // copy properties which are READ/WRITEable - but not USERARCHIVEd or PRESERVEd
-  int checked  = SGPropertyNode::READ+SGPropertyNode::WRITE+
-                 SGPropertyNode::USERARCHIVE+SGPropertyNode::PRESERVE;
-  int expected = SGPropertyNode::READ+SGPropertyNode::WRITE;
-  if (!copyProperties(props, initial_state, expected, checked))
-    SG_LOG(SG_GENERAL, SG_ALERT, "Error saving initial state");
-    
-  // delete various properties from the initial state, since we want to
-  // preserve their values even if doing a restore
-  // => Properties should now use the PRESERVE flag to protect their values
-  // on sim-reset. Remove some specific properties for backward compatibility.
-  SGPropertyNode* sim = initial_state->getChild("sim");
-  SGPropertyNode* cameraGroupNode = sim->getNode("rendering/camera-group");
-  if (cameraGroupNode) {
-    cameraGroupNode->removeChild("camera");
-    cameraGroupNode->removeChild("gui");
-  }
-}
-
 static std::string autosaveName()
 {
     std::ostringstream os;
@@ -640,28 +614,6 @@ static std::string autosaveName()
     return os.str();
 }
 
-// Restore the saved initial state, if any
-void
-FGGlobals::restoreInitialState ()
-{
-    if ( initial_state == 0 ) {
-        SG_LOG(SG_GENERAL, SG_ALERT,
-               "No initial state available to restore!!!");
-        return;
-    }
-    // copy properties which are READ/WRITEable - but not USERARCHIVEd or PRESERVEd
-    int checked  = SGPropertyNode::READ+SGPropertyNode::WRITE+
-                   SGPropertyNode::USERARCHIVE+SGPropertyNode::PRESERVE;
-    int expected = SGPropertyNode::READ+SGPropertyNode::WRITE;
-    if ( copyProperties(initial_state, props, expected, checked)) {
-        SG_LOG( SG_GENERAL, SG_INFO, "Initial state restored successfully" );
-    } else {
-        SG_LOG( SG_GENERAL, SG_INFO,
-                "Some errors restoring initial state (read-only props?)" );
-    }
-
-}
-
 // Load user settings from autosave.xml
 void
 FGGlobals::loadUserSettings(const SGPath& dataPath)
index 61ee6ebfc7d5c7c8c48e3702808635ed55d1d5bc..8e04f478f8fd7ff099b31c6822c7fd191f25f66e 100644 (file)
@@ -78,7 +78,6 @@ private:
 
     // properties, destroy last
     SGPropertyNode_ptr props;
-    SGPropertyNode_ptr initial_state;
 
     // localization
     FGLocale* locale;
@@ -321,17 +320,6 @@ public:
   
     inline FGTACANList *get_channellist() const { return channellist; }
     inline void set_channellist( FGTACANList *c ) { channellist = c; }
-  
-   /**
-     * Save the current state as the initial state.
-     */
-    void saveInitialState ();
-
-
-    /**
-     * Restore the saved initial state, if any.
-     */
-    void restoreInitialState ();
 
     /**
      * Load user settings from autosave.xml