#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 ();
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();
+ }
+ }
}
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());
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);
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()" );
}
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);
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
}
-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;
}