From: ThorstenB Date: Sun, 12 Jun 2011 11:53:14 +0000 (+0200) Subject: Do not reset persistent properties on sim-reset. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=505d4c5219bf46b4ec640f5dd903dda58ae7a09b;p=flightgear.git Do not reset persistent properties on sim-reset. 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. --- diff --git a/src/Main/globals.cxx b/src/Main/globals.cxx index b7d9b7d6d..62ae38ffa 100644 --- a/src/Main/globals.cxx +++ b/src/Main/globals.cxx @@ -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,