+// 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>
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;
void FDMShell::unbind()
{
- _impl->unbind();
+ if( _impl ) _impl->unbind();
}
void FDMShell::update(double dt)
double lon = fgGetDouble("/sim/presets/longitude-deg");
double lat = fgGetDouble("/sim/presets/latitude-deg");
- double range = 1000.0; // in metres
+ double range = 1000.0; // in meters
SGGeod geod = SGGeod::fromDeg(lon, lat);
if (globals->get_scenery()->scenery_available(geod, range)) {
SG_LOG(SG_FLIGHT, SG_INFO, "Scenery loaded, will init FDM");
_impl->bind();
evil_global_fdm_state = _impl;
+ fgSetBool("/sim/fdm-initialized", true);
fgSetBool("/sim/signals/fdm-initialized", true);
}
}