Reset: use new copy-properties helper.
This commit is contained in:
parent
f07042f7d7
commit
b3534ff8c2
2 changed files with 9 additions and 6 deletions
|
@ -941,9 +941,7 @@ void fgStartNewReset()
|
||||||
{
|
{
|
||||||
SGPropertyNode_ptr preserved(new SGPropertyNode);
|
SGPropertyNode_ptr preserved(new SGPropertyNode);
|
||||||
|
|
||||||
// copy properties which are USERARCHIVEd or PRESERVEd
|
if (!copyPropertiesWithAttribute(globals->get_props(), preserved, SGPropertyNode::PRESERVE))
|
||||||
int checked = SGPropertyNode::USERARCHIVE+SGPropertyNode::PRESERVE;
|
|
||||||
if (!copyProperties(globals->get_props(), preserved, checked, checked))
|
|
||||||
SG_LOG(SG_GENERAL, SG_ALERT, "Error saving preserved state");
|
SG_LOG(SG_GENERAL, SG_ALERT, "Error saving preserved state");
|
||||||
|
|
||||||
fgSetBool("/sim/signals/reinit", true);
|
fgSetBool("/sim/signals/reinit", true);
|
||||||
|
@ -953,7 +951,7 @@ void fgStartNewReset()
|
||||||
subsystemManger->shutdown();
|
subsystemManger->shutdown();
|
||||||
subsystemManger->unbind();
|
subsystemManger->unbind();
|
||||||
|
|
||||||
// remove them all (with some exceptions?)
|
// remove most subsystems, with a few exceptions.
|
||||||
for (int g=0; g<SGSubsystemMgr::MAX_GROUPS; ++g) {
|
for (int g=0; g<SGSubsystemMgr::MAX_GROUPS; ++g) {
|
||||||
SGSubsystemGroup* grp = subsystemManger->get_group(static_cast<SGSubsystemMgr::GroupType>(g));
|
SGSubsystemGroup* grp = subsystemManger->get_group(static_cast<SGSubsystemMgr::GroupType>(g));
|
||||||
const string_list& names(grp->member_names());
|
const string_list& names(grp->member_names());
|
||||||
|
@ -1002,12 +1000,13 @@ void fgStartNewReset()
|
||||||
simgear::clearEffectCache();
|
simgear::clearEffectCache();
|
||||||
simgear::SGModelLib::resetPropertyRoot();
|
simgear::SGModelLib::resetPropertyRoot();
|
||||||
|
|
||||||
globals->resetPropertyRoot();
|
simgear::GlobalParticleCallback::setSwitch(NULL);
|
||||||
|
|
||||||
|
globals->resetPropertyRoot();
|
||||||
fgInitConfig(0, NULL, true);
|
fgInitConfig(0, NULL, true);
|
||||||
fgInitGeneral(); // all of this?
|
fgInitGeneral(); // all of this?
|
||||||
|
|
||||||
if ( copyProperties(preserved, globals->get_props(), checked, checked)) {
|
if ( copyProperties(preserved, globals->get_props()) ) {
|
||||||
SG_LOG( SG_GENERAL, SG_INFO, "Preserved state restored successfully" );
|
SG_LOG( SG_GENERAL, SG_INFO, "Preserved state restored successfully" );
|
||||||
} else {
|
} else {
|
||||||
SG_LOG( SG_GENERAL, SG_INFO,
|
SG_LOG( SG_GENERAL, SG_INFO,
|
||||||
|
|
|
@ -1928,6 +1928,10 @@ void Options::initAircraft()
|
||||||
SG_LOG(SG_INPUT, SG_INFO, "No user specified aircraft, using default" );
|
SG_LOG(SG_INPUT, SG_INFO, "No user specified aircraft, using default" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// persist across reset
|
||||||
|
SGPropertyNode* aircraftProp = fgGetNode("/sim/aircraft", true);
|
||||||
|
aircraftProp->setAttribute(SGPropertyNode::PRESERVE, true);
|
||||||
|
|
||||||
if (p->showAircraft) {
|
if (p->showAircraft) {
|
||||||
fgOptLogLevel( "alert" );
|
fgOptLogLevel( "alert" );
|
||||||
SGPath path( globals->get_fg_root() );
|
SGPath path( globals->get_fg_root() );
|
||||||
|
|
Loading…
Add table
Reference in a new issue