]> git.mxchange.org Git - flightgear.git/blobdiff - src/Main/main.cxx
Update image-server logic.
[flightgear.git] / src / Main / main.cxx
index 8b7083470435939304af740facfe3a38fa6db73c..c146a14c1a5e0cb524c8692646ffed96f166251f 100644 (file)
 #include <osg/GraphicsContext>
 #include <osgDB/Registry>
 
+#if defined(HAVE_CRASHRPT)
+       #include <CrashRpt.h>
+
+// defined in bootstrap.cxx
+extern bool global_crashRptEnabled;
+
+#endif
+
 // Class references
 #include <simgear/canvas/VGInitOperation.hxx>
 #include <simgear/scene/model/modellib.hxx>
 #include <simgear/scene/material/matlib.hxx>
+#include <simgear/scene/material/Effect.hxx>
 #include <simgear/props/AtomicChangeListener.hxx>
 #include <simgear/props/props.hxx>
 #include <simgear/timing/sg_time.hxx>
@@ -55,6 +64,7 @@
 #include <Viewer/renderer.hxx>
 #include <Viewer/WindowSystemAdapter.hxx>
 #include <Navaids/NavDataCache.hxx>
+#include <Include/version.h>
 
 #include "fg_commands.hxx"
 #include "fg_io.hxx"
 #include "fg_os.hxx"
 #include "fg_props.hxx"
 #include "positioninit.hxx"
+#include "screensaver_control.hxx"
 #include "subsystemFactory.hxx"
 #include "options.hxx"
 
+
 using namespace flightgear;
 
 using std::cerr;
@@ -98,6 +110,11 @@ static void fgMainLoop( void )
 
 static void initTerrasync()
 {
+    // add the terrasync root as a data path so data can be retrieved from it
+    // (even if we are in read-only mode)
+    std::string terraSyncDir(fgGetString("/sim/terrasync/scenery-dir"));
+    globals->append_data_path(terraSyncDir);
+    
     if (fgGetBool("/sim/fghome-readonly", false)) {
         return;
     }
@@ -124,10 +141,6 @@ static void initTerrasync()
     
     terra_sync->bind();
     terra_sync->init();
-    
-    // add the terrasync root as a data path so data can be retrieved from it
-    std::string terraSyncDir(fgGetString("/sim/terrasync/scenery-dir"));
-    globals->append_data_path(terraSyncDir);
 }
 
 static void registerMainLoop()
@@ -299,7 +312,9 @@ static void upper_case_property(const char *name)
         else
             assert(t == props::STRING);
     }
-    p->addChangeListener(new FGMakeUpperCase);
+    SGPropertyChangeListener* muc = new FGMakeUpperCase;
+    globals->addListenerToCleanup(muc);
+    p->addChangeListener(muc);
 }
 
 // see http://code.google.com/p/flightgear-bugs/issues/detail?id=385
@@ -333,6 +348,15 @@ static void logToFile()
         logPath.append("fgfs.log");
     }
     sglog().logToFile(logPath, SG_ALL, SG_INFO);
+
+#if defined(HAVE_CRASHRPT)
+       if (global_crashRptEnabled) {
+               crAddFile2(logPath.c_str(), NULL, "FlightGear Log File", CR_AF_MAKE_FILE_COPY);
+               SG_LOG( SG_GENERAL, SG_INFO, "CrashRpt enabled");
+       } else {
+               SG_LOG(SG_GENERAL, SG_WARN, "CrashRpt enabled at compile time but failed to install");
+       }
+#endif
 }
 
 // Main top level initialization
@@ -359,7 +383,9 @@ int fgMainInit( int argc, char **argv ) {
 #endif
     SG_LOG( SG_GENERAL, SG_INFO, "FlightGear:  Version "
             << version );
-    SG_LOG( SG_GENERAL, SG_INFO, "Built with " << SG_COMPILER_STR << std::endl );
+    SG_LOG( SG_GENERAL, SG_INFO, "Built with " << SG_COMPILER_STR);
+       SG_LOG( SG_GENERAL, SG_INFO, "Jenkins number/ID " << HUDSON_BUILD_NUMBER << ":"
+                       << HUDSON_BUILD_ID);
 
     // Allocate global data structures.  This needs to happen before
     // we parse command line options
@@ -426,11 +452,16 @@ int fgMainInit( int argc, char **argv ) {
     
     fgOutputSettings();
     
+    //try to disable the screensaver
+    fgOSDisableScreensaver();
+    
     // pass control off to the master event handler
     int result = fgOSMainLoop();
     frame_signal.clear();
     fgOSCloseWindow();
     
+    simgear::clearEffectCache();
+    
     // clean up here; ensure we null globals to avoid
     // confusing the atexit() handler
     delete globals;