1
0
Fork 0

Save/restore initial state removed.

This commit is contained in:
James Turner 2014-03-10 17:29:28 +00:00
parent 9489009570
commit cc607ae7e4
4 changed files with 1 additions and 67 deletions

View 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)

View 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;
}

View 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)

View 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