]> git.mxchange.org Git - flightgear.git/commitdiff
Do not reset persistent properties on sim-reset.
authorThorstenB <brehmt@gmail.com>
Sun, 12 Jun 2011 11:53:14 +0000 (13:53 +0200)
committerThorstenB <brehmt@gmail.com>
Sun, 12 Jun 2011 11:53:14 +0000 (13:53 +0200)
Fixed ugly sim-reset issue: Persistent properties (USERARCHIVE attribute)
are retained across sim sessions (when restarting the sim). So they should
also be retained on sim-resets (without the need to first exit/restart
the sim to make them really persistent).
Also, avoid warning due to read-only properties.

src/Main/globals.cxx

index b7d9b7d6d9a2eabf0691029ed48a12de7582591d..62ae38ffadd1fa3c3416acd7bcc2de1e2e60c818 100644 (file)
@@ -364,7 +364,10 @@ FGGlobals::saveInitialState ()
 {
   initial_state = new SGPropertyNode();
 
-  if (!copyProperties(props, initial_state))
+  // copy properties which are READ/WRITEable - but not USERARCHIVEd
+  if (!copyProperties(props, initial_state,
+          SGPropertyNode::READ+SGPropertyNode::WRITE,
+          SGPropertyNode::READ+SGPropertyNode::WRITE+SGPropertyNode::USERARCHIVE))
     SG_LOG(SG_GENERAL, SG_ALERT, "Error saving initial state");
     
   // delete various properties from the initial state, since we want to
@@ -393,8 +396,10 @@ FGGlobals::restoreInitialState ()
                "No initial state available to restore!!!");
         return;
     }
-
-    if ( copyProperties(initial_state, props) ) {
+    // restore properties which are READ/WRITEable - but not USERARCHIVEd
+    if ( copyProperties(initial_state, props,
+            SGPropertyNode::READ+SGPropertyNode::WRITE,
+            SGPropertyNode::READ+SGPropertyNode::WRITE+SGPropertyNode::USERARCHIVE)) {
         SG_LOG( SG_GENERAL, SG_INFO, "Initial state restored successfully" );
     } else {
         SG_LOG( SG_GENERAL, SG_INFO,