]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/fdm_shell.cxx
Bugfix: no automatic runway selection with --parkpos=
[flightgear.git] / src / FDM / fdm_shell.cxx
index 6c2d095370322c0ae5abf1c6a8edf5bb2fc38b44..aaf94a6e73476bc20f359cf448211189b212f4a4 100644 (file)
@@ -1,7 +1,30 @@
+// fdm_shell.cxx -- encapsulate FDM implementations as well-behaved subsystems
+//
+// Written by James Turner, started June 2010.
+//
+// Copyright (C) 2010  Curtis L. Olson  - http://www.flightgear.org/~curt
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License as
+// published by the Free Software Foundation; either version 2 of the
+// License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+//
+// $Id$
+
 #ifdef HAVE_CONFIG_H
 #  include <config.h>
 #endif
 
+#include <cassert>
 #include <simgear/structure/exception.hxx>
 
 #include <FDM/fdm_shell.hxx>
@@ -46,13 +69,14 @@ FDMShell::~FDMShell()
 void FDMShell::init()
 {
   _props = globals->get_props();
+  fgSetBool("/sim/fdm-initialized", false);
   createImplementation();
 }
 
 void FDMShell::reinit()
 {
   if (_impl) {
-    fgSetBool("/sim/signals/fdm-initialized", false);
+    fgSetBool("/sim/fdm-initialized", false);
     evil_global_fdm_state = NULL;
     _impl->unbind();
     delete _impl;
@@ -75,7 +99,7 @@ void FDMShell::bind()
 
 void FDMShell::unbind()
 {
-  _impl->unbind();
+  if( _impl ) _impl->unbind();
 }
 
 void FDMShell::update(double dt)
@@ -100,6 +124,7 @@ void FDMShell::update(double dt)
         _impl->bind();
         
         evil_global_fdm_state = _impl;
+        fgSetBool("/sim/fdm-initialized", true);
         fgSetBool("/sim/signals/fdm-initialized", true);
     }
   }