]> git.mxchange.org Git - flightgear.git/commitdiff
Add an option to enable or disable the save-on-exit option. Add a season commandline...
authorehofman <ehofman>
Thu, 22 Dec 2005 13:51:11 +0000 (13:51 +0000)
committerehofman <ehofman>
Thu, 22 Dec 2005 13:51:11 +0000 (13:51 +0000)
src/Main/fg_commands.cxx
src/Main/options.cxx

index f2189ad57496008e39db7d9b344c08cc534bfe6a..97f017f22137bcf2557929194b6242c27637039f 100644 (file)
@@ -39,6 +39,7 @@
 #include "logger.hxx"
 #include "util.hxx"
 #include "viewmgr.hxx"
+#include "main.hxx"
 
 SG_USING_STD(string);
 SG_USING_STD(ifstream);
@@ -191,29 +192,28 @@ do_exit (const SGPropertyNode * arg)
 {
     SG_LOG(SG_INPUT, SG_INFO, "Program exit requested.");
 
+    if (fgGetBool("/sim/startup/save-on-exit")) {
 #ifdef _MSC_VER
-    char* envp = ::getenv( "APPDATA" );
+        char* envp = ::getenv( "APPDATA" );
+        if ( envp != NULL ) {
+            SGPath config( envp );
+            config.append( "flightgear.org" );
 #else
-    char* envp = ::getenv( "HOME" );
+        if ( homedir != NULL ) {
+            SGPath config( homedir );
+            config.append( ".fgfs" );
 #endif
-    if ( envp != NULL ) {
-        SGPath config( globals->get_fg_root() );
-        config.set( envp );
-#ifdef _MSC_VER
-        config.append( "flightgear.org" );
-#else
-        config.append( ".fgfs" );
-#endif
-        config.append( "preferences.xml" );
-        config.create_dir( 0700 );
-        SG_LOG(SG_IO, SG_INFO, "Saving user preferences");
-        try {
-            writeProperties(config.str(), globals->get_props(), false, SGPropertyNode::USERARCHIVE);
-        } catch (const sg_exception &e) {
-            guiErrorMessage("Error saving preferences: ", e);
-        }
+            config.append( "preferences.xml" );
+            config.create_dir( 0700 );
+            SG_LOG(SG_IO, SG_INFO, "Saving user preferences");
+            try {
+                writeProperties(config.str(), globals->get_props(), false, SGPropertyNode::USERARCHIVE);
+            } catch (const sg_exception &e) {
+                guiErrorMessage("Error saving preferences: ", e);
+            }
 
-        SG_LOG(SG_INPUT, SG_BULK, "Finished Saving user preferences");
+            SG_LOG(SG_INPUT, SG_BULK, "Finished Saving user preferences");
+        }
     }
     fgExit(arg->getIntValue("status", 0));
     return true;
index 8fe9ab211215db38667a76ade5d781b1a3662c03..453f0e1ac3d01299a83d58a83bbc4049557786f4 100644 (file)
@@ -1297,6 +1297,8 @@ struct OptionDesc {
     {"aspect-ratio-multiplier",      true,  OPTION_DOUBLE, "/sim/current-view/aspect-ratio-multiplier", false, "", 0 },
     {"disable-fullscreen",           false, OPTION_BOOL,   "/sim/startup/fullscreen", false, "", 0 },
     {"enable-fullscreen",            false, OPTION_BOOL,   "/sim/startup/fullscreen", true, "", 0 },
+    {"disable-save-on-exit",         false, OPTION_BOOL,   "/sim/startup/save-on-exit", false, "", 0 },
+    {"enable-save-on-exit",          false, OPTION_BOOL,   "/sim/startup/save-on-exit", true, "", 0 },
     {"shading-flat",                 false, OPTION_BOOL,   "/sim/rendering/shading", false, "", 0 },
     {"shading-smooth",               false, OPTION_BOOL,   "/sim/rendering/shading", true, "", 0 },
     {"disable-skyblend",             false, OPTION_BOOL,   "/sim/rendering/skyblend", false, "", 0 },
@@ -1310,6 +1312,7 @@ struct OptionDesc {
     {"units-feet",                   false, OPTION_STRING, "/sim/startup/units", false, "feet", 0 },
     {"units-meters",                 false, OPTION_STRING, "/sim/startup/units", false, "meters", 0 },
     {"timeofday",                    true,  OPTION_STRING, "/sim/startup/time-offset-type", false, "noon", 0 },
+    {"season",                       true,  OPTION_STRING, "/sim/startup/season", false, "summer", 0 },
     {"time-offset",                  true,  OPTION_FUNC,   "", false, "", fgOptTimeOffset },
     {"time-match-real",              false, OPTION_STRING, "/sim/startup/time-offset-type", false, "system-offset", 0 },
     {"time-match-local",             false, OPTION_STRING, "/sim/startup/time-offset-type", false, "latitude-offset", 0 },