#include <cassert>
#include <simgear/structure/exception.hxx>
+#include <simgear/props/props_io.hxx>
#include <FDM/fdm_shell.hxx>
#include <FDM/flight.hxx>
createImplementation();
}
+void FDMShell::postinit()
+{
+ _initialFdmProperties = new SGPropertyNode;
+
+ if (!copyProperties(_props->getNode("fdm", true),
+ _initialFdmProperties))
+ {
+ SG_LOG(SG_FLIGHT, SG_ALERT, "Failed to save initial FDM property state");
+ }
+}
+
void FDMShell::shutdown()
{
if (_impl) {
void FDMShell::reinit()
{
shutdown();
+
+ if ( copyProperties(_initialFdmProperties, fgGetNode("/fdm", true)) ) {
+ SG_LOG( SG_FLIGHT, SG_INFO, "Preserved state restored successfully" );
+ } else {
+ SG_LOG( SG_FLIGHT, SG_WARN,
+ "FDM: Some errors restoring preserved state" );
+ }
+
+
init();
}