]> git.mxchange.org Git - flightgear.git/blobdiff - src/Main/options.cxx
Crash-fix: mat-lib is now reference-counted.
[flightgear.git] / src / Main / options.cxx
index 06e57f36f35963d879ceae520903955346215f8e..3c20cdee8a8154d97cdeab7822e9feaa46bf50eb 100644 (file)
 #  include <Include/no_version.h>
 #endif
 
-#ifdef __APPLE__
-#  include <CoreFoundation/CoreFoundation.h>
-#endif
-
 using std::string;
 using std::sort;
 using std::cout;
@@ -189,7 +185,6 @@ void fgSetDefaults ()
     fgSetBool("/environment/clouds/status", true);
     fgSetBool("/sim/startup/fullscreen", false);
     fgSetBool("/sim/rendering/shading", true);
-    fgSetBool("/sim/rendering/skyblend", true);
     fgSetBool("/sim/rendering/textures", true);
     fgTie( "/sim/rendering/filtering", SGGetTextureFilter, SGSetTextureFilter, false);
     fgSetInt("/sim/rendering/filtering", 1);
@@ -1537,8 +1532,6 @@ struct OptionDesc {
     {"restore-defaults",             false, OPTION_BOOL,   "/sim/startup/restore-defaults", 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 },
-    {"enable-skyblend",              false, OPTION_BOOL,   "/sim/rendering/skyblend", true, "", 0 },
     {"disable-textures",             false, OPTION_BOOL,   "/sim/rendering/textures", false, "", 0 },
     {"enable-textures",              false, OPTION_BOOL,   "/sim/rendering/textures", true, "", 0 },
     {"texture-filtering",            false, OPTION_INT,    "/sim/rendering/filtering", 1, "", 0 },
@@ -1932,6 +1925,10 @@ void Options::initAircraft()
     SG_LOG(SG_INPUT, SG_INFO, "No user specified aircraft, using default" );
   }
   
+// persist across reset
+  SGPropertyNode* aircraftProp = fgGetNode("/sim/aircraft", true);
+  aircraftProp->setAttribute(SGPropertyNode::PRESERVE, true);
+    
   if (p->showAircraft) {
     fgOptLogLevel( "alert" );
     SGPath path( globals->get_fg_root() );
@@ -2170,31 +2167,30 @@ OptionResult Options::processOptions()
   }
     
 // terrasync directory fixup
+  string terrasyncDir = fgGetString("/sim/terrasync/scenery-dir");
+  if (terrasyncDir.empty()) {
+    SGPath p(globals->get_fg_home());
+    p.append("TerraSync");
+    terrasyncDir = p.str();
+    SG_LOG(SG_GENERAL, SG_INFO,
+           "Using default TerraSync dir: " << terrasyncDir);
+    fgSetString("/sim/terrasync/scenery-dir", terrasyncDir);
+  }
+  
+  SGPath p(terrasyncDir);
+  // following is necessary to ensure NavDataCache sees stable scenery paths from
+  // terrasync. Ensure the Terrain and Objects subdirs exist immediately, rather
+  // than waiting for the first tiles to be scheduled.
+  simgear::Dir terrainDir(SGPath(p, "Terrain")),
+    objectsDir(SGPath(p, "Objects"));
+  if (!terrainDir.exists()) {
+      terrainDir.create(0755);
+  }
+  
+  if (!objectsDir.exists()) {
+      objectsDir.create(0755);
+  }
   if (fgGetBool("/sim/terrasync/enabled")) {
-    string terrasyncDir = fgGetString("/sim/terrasync/scenery-dir");
-    if (terrasyncDir.empty()) {
-      SGPath p(globals->get_fg_home());
-      p.append("TerraSync");
-      terrasyncDir = p.str();
-      SG_LOG(SG_GENERAL, SG_INFO,
-             "Using default TerraSync dir: " << terrasyncDir);
-      fgSetString("/sim/terrasync/scenery-dir", terrasyncDir);
-    }
-      
-      SGPath p(terrasyncDir);
-      // following is necessary to ensure NavDataCache sees stable scenery paths from
-      // terrasync. Ensure the Terrain and Objects subdirs exist immediately, rather
-      // than waiting for the first tiles to be scheduled.
-      simgear::Dir terrainDir(SGPath(p, "Terrain")),
-        objectsDir(SGPath(p, "Objects"));
-      if (!terrainDir.exists()) {
-          terrainDir.create(0755);
-      }
-      
-      if (!objectsDir.exists()) {
-          objectsDir.create(0755);
-      }
-      
     const string_list& scenery_paths(globals->get_fg_scenery());
     if (std::find(scenery_paths.begin(), scenery_paths.end(), terrasyncDir) == scenery_paths.end()) {
       // terrasync dir is not in the scenery paths, add it
@@ -2209,7 +2205,7 @@ OptionResult Options::processOptions()
     globals->append_fg_scenery(root.str());
   }
     
-    return FG_OPTIONS_OK;
+  return FG_OPTIONS_OK;
 }
   
 void Options::showUsage() const
@@ -2350,36 +2346,13 @@ string Options::platformDefaultRoot() const
   return "../data";
 }
 
-#elif defined(_WIN32)
+#elif defined(SG_WINDOWS)
 string Options::platformDefaultRoot() const
 {
   return "..\\data";
 }
-#elif defined(__APPLE__)
-string Options::platformDefaultRoot() const
-{
-  /*
-   The following code looks for the base package inside the application 
-   bundle, in the standard Contents/Resources location. 
-   */
-  CFURLRef resourcesUrl = CFBundleCopyResourcesDirectoryURL(CFBundleGetMainBundle());
-  
-  // look for a 'data' subdir
-  CFURLRef dataDir = CFURLCreateCopyAppendingPathComponent(NULL, resourcesUrl, CFSTR("data"), true);
-  
-  CFURLRef absoluteDataUrl = CFURLCopyAbsoluteURL(dataDir);
-  
-  // now convert down to a path, and the a c-string
-  CFStringRef path = CFURLCopyFileSystemPath(absoluteDataUrl, kCFURLPOSIXPathStyle);  
-  string root = CFStringGetCStringPtr(path, CFStringGetSystemEncoding());
-  
-  CFRelease(absoluteDataUrl);
-  CFRelease(resourcesUrl);
-  CFRelease(dataDir);
-  CFRelease(path);
-  
-  return root;
-}
+#elif defined(SG_MAC)
+// platformDefaultRoot defined in CocoaHelpers.mm
 #else
 string Options::platformDefaultRoot() const
 {