]> 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 74a3a6578200cc7409e92deb7c11e07a5d8d7fa8..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 ();
@@ -233,12 +231,17 @@ getFreeze ()
 static void
 setFreeze (bool f)
 {
-  frozen = f;
-                               // Stop sound on a pause
-  if (f)
-    globals->get_soundmgr()->pause();
-  else
-    globals->get_soundmgr()->resume();
+    frozen = f;
+
+    // Stop sound on a pause
+    FGSoundMgr *s = globals->get_soundmgr();
+    if ( s != NULL ) {
+        if ( f ) {
+            s->pause();
+        } else {
+            s->resume();
+        }
+    }
 }
 
 
@@ -460,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());
@@ -575,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);
@@ -614,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()" );
 }
 
 
@@ -637,12 +640,12 @@ bool
 fgSaveFlight (ostream &output, bool write_all)
 {
 
-  fgSetBool("/sim/startup/onground", false);
-  fgSetArchivable("/sim/startup/onground");
-  fgSetBool("/sim/startup/trim", false);
-  fgSetArchivable("/sim/startup/trim");
-  fgSetString("/sim/startup/speed-set", "UVW");
-  fgSetArchivable("/sim/startup/speed-set");
+  fgSetBool("/sim/presets/onground", false);
+  fgSetArchivable("/sim/presets/onground");
+  fgSetBool("/sim/presets/trim", false);
+  fgSetArchivable("/sim/presets/trim");
+  fgSetString("/sim/presets/speed-set", "UVW");
+  fgSetArchivable("/sim/presets/speed-set");
 
   try {
     writeProperties(output, globals->get_props(), write_all);
@@ -668,9 +671,9 @@ fgLoadFlight (istream &input)
     return false;
   }
 
-  fgSetBool("/sim/startup/onground", false);
-  fgSetBool("/sim/startup/trim", false);
-  fgSetString("/sim/startup/speed-set", "UVW");
+  fgSetBool("/sim/presets/onground", false);
+  fgSetBool("/sim/presets/trim", false);
+  fgSetString("/sim/presets/speed-set", "UVW");
 
   copyProperties(&props, globals->get_props());
   // When loading a flight, make it the
@@ -680,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;
 }