From cc607ae7e4b9c5f7ef4c90d947a60ab8a73d890b Mon Sep 17 00:00:00 2001 From: James Turner Date: Mon, 10 Mar 2014 17:29:28 +0000 Subject: [PATCH] Save/restore initial state removed. --- src/Main/fg_init.cxx | 4 ---- src/Main/fg_props.cxx | 4 +--- src/Main/globals.cxx | 48 ------------------------------------------- src/Main/globals.hxx | 12 ----------- 4 files changed, 1 insertion(+), 67 deletions(-) diff --git a/src/Main/fg_init.cxx b/src/Main/fg_init.cxx index 6c5ca203c..d39f3ef61 100644 --- a/src/Main/fg_init.cxx +++ b/src/Main/fg_init.cxx @@ -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) diff --git a/src/Main/fg_props.cxx b/src/Main/fg_props.cxx index bf62711c8..a93529dff 100644 --- a/src/Main/fg_props.cxx +++ b/src/Main/fg_props.cxx @@ -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; } diff --git a/src/Main/globals.cxx b/src/Main/globals.cxx index 8ed71cbd5..2617067d2 100644 --- a/src/Main/globals.cxx +++ b/src/Main/globals.cxx @@ -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) diff --git a/src/Main/globals.hxx b/src/Main/globals.hxx index 61ee6ebfc..8e04f478f 100644 --- a/src/Main/globals.hxx +++ b/src/Main/globals.hxx @@ -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 -- 2.39.5