globals->saveInitialState();
}
-// Reset: this is what the 'reset' command (and hence, GUI) is attached to
-void fgReInitSubsystems()
-{
-#ifdef NEW_RESET
- fgResetIdleState();
- return;
-#endif
-
- SGPropertyNode *master_freeze = fgGetNode("/sim/freeze/master");
-
- SG_LOG( SG_GENERAL, SG_INFO, "fgReInitSubsystems()");
-
-// setup state to begin re-init
- bool freeze = master_freeze->getBoolValue();
- if ( !freeze ) {
- master_freeze->setBoolValue(true);
- }
-
- fgSetBool("/sim/signals/reinit", true);
- fgSetBool("/sim/crashed", false);
-
-// do actual re-init steps
- globals->get_subsystem("flight")->unbind();
-
- // reset control state, before restoring initial state; -set or config files
- // may specify values for flaps, trim tabs, magnetos, etc
- globals->get_controls()->reset_all();
-
- globals->restoreInitialState();
-
- // update our position based on current presets
- // this will mark position as needed finalized which we'll do in the
- // main-loop
- flightgear::initPosition();
-
- simgear::SGTerraSync* terraSync =
- static_cast<simgear::SGTerraSync*>(globals->get_subsystem("terrasync"));
- if (terraSync) {
- terraSync->reposition();
- }
-
- // Force reupdating the positions of the ai 3d models. They are used for
- // initializing ground level for the FDM.
- globals->get_subsystem("ai-model")->reinit();
-
- // Initialize the FDM
- globals->get_subsystem("flight")->reinit();
-
- // reset replay buffers
- globals->get_subsystem("replay")->reinit();
-
- // reload offsets from config defaults
- globals->get_viewmgr()->reinit();
-
- // ugly: finalizePosition waits for METAR to arrive for the new airport.
- // we don't re-init the environment manager here, since historically we did
- // not, and doing so seems to have other issues. All that's needed is to
- // schedule METAR fetch immediately, so it's available for finalizePosition.
- // So we manually extract the METAR-fetching component inside the environment
- // manager, and re-init that.
- SGSubsystemGroup* envMgr = static_cast<SGSubsystemGroup*>(globals->get_subsystem("environment"));
- if (envMgr) {
- envMgr->get_subsystem("realwx")->reinit();
- }
-
- globals->get_subsystem("time")->reinit();
-
- // need to bind FDMshell again, since we manually unbound it above...
- globals->get_subsystem("flight")->bind();
-
- // need to reset aircraft (systems/instruments) so they can adapt to current environment
- globals->get_subsystem("systems")->reinit();
- globals->get_subsystem("instrumentation")->reinit();
-
-// setup state to end re-init
- fgSetBool("/sim/signals/reinit", false);
- if ( !freeze ) {
- master_freeze->setBoolValue(false);
- }
- fgSetBool("/sim/sceneryloaded",false);
-}
-
-
// re-position is a simplified version of the traditional (legacy)
// reset procedure. We only need to poke systems which will be upset by
// a sudden change in aircraft position. Since this potentially includes