]> git.mxchange.org Git - flightgear.git/blobdiff - src/Main/fg_props.cxx
Move the texture loader to SimGear
[flightgear.git] / src / Main / fg_props.cxx
index 93c205d1e7f80cd1878c34ba99aeabaad7382ba6..8b2f202ae5ab2d0fc9aae4b832afdf178495c64e 100644 (file)
 #include "fgfs.hxx"
 #include "fg_props.hxx"
 
-#if !defined(SG_HAVE_NATIVE_SGI_COMPILERS)
 SG_USING_STD(istream);
 SG_USING_STD(ostream);
-#endif
 
 #ifdef FG_WEATHERCM
 static double getWindNorth ();
@@ -465,7 +463,7 @@ getWindEast ()
 static void
 setWindEast (double speed)
 {
-  cout << "Set wind-east to " << speed << endl;
+  SG_LOG(SG_GENERAL, SG_INFO,, "Set wind-east to " << speed );
   current_aircraft.fdm_state->set_Velocities_Local_Airmass(getWindNorth(),
                                                           speed,
                                                           getWindDown());
@@ -580,7 +578,7 @@ setFDMDataLogging (bool state)
 void
 fgInitProps ()
 {
-  cout << "start of fgInitProps()" << endl;
+  SG_LOG(SG_GENERAL, SG_DEBUG, "start of fgInitProps()" );
                                // Simulation
   fgTie("/sim/logging/priority", getLoggingPriority, setLoggingPriority);
   fgTie("/sim/logging/classes", getLoggingClasses, setLoggingClasses);
@@ -619,7 +617,7 @@ fgInitProps ()
   fgTie("/sim/temp/full-screen", getFullScreen, setFullScreen);
   fgTie("/sim/temp/fdm-data-logging", getFDMDataLogging, setFDMDataLogging);
 
-  cout << "end of fgInitProps()" << endl;
+  SG_LOG(SG_GENERAL, SG_DEBUG, "end of fgInitProps()" );
 }
 
 
@@ -685,12 +683,25 @@ fgLoadFlight (istream &input)
 }
 
 
-void
-fgLoadProps (const char * path, SGPropertyNode * props)
-{
-    SGPath loadpath(globals->get_fg_root());
-    loadpath.append(path);
-    readProperties(loadpath.c_str(), props);
+bool
+fgLoadProps (const char * path, SGPropertyNode * props, bool in_fg_root)
+{
+    string fullpath;
+    if (in_fg_root) {
+        SGPath loadpath(globals->get_fg_root());
+        loadpath.append(path);
+        fullpath = loadpath.str();
+    } else {
+        fullpath = path;
+    }
+
+    try {
+        readProperties(fullpath, props);
+    } catch (const sg_exception &e) {
+        guiErrorMessage("Error reading properties: ", e);
+        return false;
+    }
+    return true;
 }