void initMenu()
{
SGPropertyNode main;
- SGPath spath( globals->get_fg_root() );
- spath.append( "menu.xml" );
try {
- readProperties(spath.c_str(), &main);
+ fgLoadProps("menu.xml", &main);
} catch (const sg_exception &ex) {
SG_LOG(SG_GENERAL, SG_ALERT, "Error processing the menu file.");
return;
static bool
do_preferences_load (const SGPropertyNode * arg)
{
- const string &path = arg->getStringValue("path", "preferences.xml");
- SGPath props_path(globals->get_fg_root());
- props_path.append(path);
- SG_LOG(SG_INPUT, SG_INFO, "Reading global preferences from "
- << props_path.str());
try {
- readProperties(props_path.str(), globals->get_props());
+ fgLoadProps(arg->getStringValue("path", "preferences.xml"),
+ globals->get_props());
} catch (const sg_exception &e) {
guiErrorMessage("Error reading global preferences: ", e);
return false;
fgSetDefaults();
// Read global preferences from $FG_ROOT/preferences.xml
- SGPath props_path(globals->get_fg_root());
- props_path.append("preferences.xml");
SG_LOG(SG_INPUT, SG_INFO, "Reading global preferences");
- readProperties(props_path.str(), globals->get_props());
+ fgLoadProps("preferences.xml", globals->get_props());
SG_LOG(SG_INPUT, SG_INFO, "Finished Reading global preferences");
// Detect the required language as early as possible
#include <simgear/misc/exception.hxx>
#include <simgear/magvar/magvar.hxx>
#include <simgear/timing/sg_time.hxx>
+#include <simgear/misc/sg_path.hxx>
#include STL_IOSTREAM
}
+void
+fgLoadProps (const char * path, SGPropertyNode * props)
+{
+ SGPath loadpath(globals->get_fg_root());
+ loadpath.append(path);
+ readProperties(loadpath.c_str(), props);
+}
+
+
\f
////////////////////////////////////////////////////////////////////////
// Property convenience functions.
extern bool fgLoadFlight (istream &input);
+/**
+ * Load properties from a file relative to $FG_ROOT.
+ *
+ * @param file The file name relative to $FG_ROOT.
+ */
+extern void fgLoadProps (const char * path, SGPropertyNode * props);
+
+
\f
////////////////////////////////////////////////////////////////////////
// Convenience functions for getting property values.
{
}
+void
+FGSubsystem::init ()
+{
+}
+
+void
+FGSubsystem::bind ()
+{
+}
+
+void
+FGSubsystem::unbind ()
+{
+}
+
void
FGSubsystem::suspend ()
{
* in the constructor, so that FlightGear can control the
* initialization order.</p>
*/
- virtual void init () = 0;
+ virtual void init ();
/**
* publishes. It will be invoked after init, but before any
* invocations of update.</p>
*/
- virtual void bind () = 0;
+ virtual void bind ();
/**
* publishes. It will be invoked by FlightGear (not the destructor)
* just before the subsystem is removed.</p>
*/
- virtual void unbind () = 0;
+ virtual void unbind ();
/**
SGPropertyNode *locale = globals->get_locale();
SGPropertyNode options_root;
- SGPath opath( globals->get_fg_root() );
- opath.append( "options.xml" );
cout << "" << endl;
try {
- readProperties(opath.c_str(), &options_root);
+ fgLoadProps("options.xml", &options_root);
} catch (const sg_exception &ex) {
cout << "Unable to read the help file." << endl;
cout << "Make sure the file options.xml is located in the FlightGear base directory," << endl;