]> git.mxchange.org Git - flightgear.git/commitdiff
Added fgLoadProps to load properties from a path relative to FG_ROOT.
authordavid <david>
Wed, 6 Nov 2002 18:57:31 +0000 (18:57 +0000)
committerdavid <david>
Wed, 6 Nov 2002 18:57:31 +0000 (18:57 +0000)
src/GUI/gui.cxx
src/Main/fg_commands.cxx
src/Main/fg_init.cxx
src/Main/fg_props.cxx
src/Main/fg_props.hxx
src/Main/fgfs.cxx
src/Main/fgfs.hxx
src/Main/options.cxx

index 5822150226cd57caa968373556e4c9dffb438415..4290659ebf033372547c396fb674de59995bba23 100644 (file)
@@ -78,11 +78,9 @@ unsigned int Menu_size;
 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;
index f6db36d8464a57ac95cd0b89e4c28131505e7f9e..4f628470990798088f044aa459f9df6b16264d06 100644 (file)
@@ -205,13 +205,9 @@ do_panel_mouse_click (const SGPropertyNode * arg)
 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;
index af0c1d25c0981d884cb848ec66467db28733b280..a603ef61f496673e2001ae216209d0ef5704a82d 100644 (file)
@@ -389,10 +389,8 @@ bool fgInitConfig ( int argc, char **argv ) {
     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
index c82aec13830172e1f052c1a41777bb99bcf16fd3..74a3a6578200cc7409e92deb7c11e07a5d8d7fa8 100644 (file)
@@ -27,6 +27,7 @@
 #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
 
@@ -679,6 +680,15 @@ fgLoadFlight (istream &input)
 }
 
 
+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.
index 1f9a1f87d0e7781c6e27a0fbc54bef9f29a590cb..0e5f311ac34706f844b2e34467d6616225e01f83 100644 (file)
@@ -64,6 +64,14 @@ extern bool fgSaveFlight (ostream &output, bool write_all = false);
 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.
index f6727b4f89ed1f98b85b9c57e1fdb1794fbe6eff..b85497fb692bdc69a326c6acd057651d0b0d560f 100644 (file)
@@ -21,6 +21,21 @@ FGSubsystem::~FGSubsystem ()
 {
 }
 
+void
+FGSubsystem::init ()
+{
+}
+
+void
+FGSubsystem::bind ()
+{
+}
+
+void
+FGSubsystem::unbind ()
+{
+}
+
 void
 FGSubsystem::suspend ()
 {
index 942eee31709e2db3208e36ea83181aed8844c15a..a1cc83b90aa5a64a805924f1f40500cd4ef0a8c8 100644 (file)
@@ -145,7 +145,7 @@ public:
    * in the constructor, so that FlightGear can control the
    * initialization order.</p>
    */
-  virtual void init () = 0;
+  virtual void init ();
 
 
   /**
@@ -155,7 +155,7 @@ public:
    * publishes.  It will be invoked after init, but before any
    * invocations of update.</p>
    */
-  virtual void bind () = 0;
+  virtual void bind ();
 
 
   /**
@@ -165,7 +165,7 @@ public:
    * publishes.  It will be invoked by FlightGear (not the destructor)
    * just before the subsystem is removed.</p>
    */
-  virtual void unbind () = 0;
+  virtual void unbind ();
 
 
   /**
index abbbcd1d491005b87ebd26c2f5508154ced17a4b..24e3a191b276030b9c8f1875f8de1402772f0c97 100644 (file)
@@ -1160,13 +1160,11 @@ fgUsage (bool verbose)
     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;