[pkg-fgfs-crew] [flightgear] 01/01: Import an intermediate revision before 3.0.0 - as of Jan 24. fgmeta git commit f16c99683eafad4bf45d39406774ebff0c51f8f4

Markus Wanner markus_wanner-guest at moszumanska.debian.org
Thu Jan 23 18:06:12 UTC 2014


This is an automated email from the git hooks/post-receive script.

markus_wanner-guest pushed a commit to branch upstream
in repository flightgear.

commit 4b412f872d07a8595098c17d8f7825b8b9467361
Author: Markus Wanner <markus at bluegap.ch>
Date:   Thu Jan 23 19:04:46 2014 +0100

    Import an intermediate revision before 3.0.0 - as of Jan 24.
    fgmeta git commit f16c99683eafad4bf45d39406774ebff0c51f8f4
---
 src/GUI/MessageBox.cxx      |  6 +++++-
 src/Main/bootstrap.cxx      | 11 ++++++++++-
 src/Main/fg_commands.cxx    | 34 +++++++++++++++++++---------------
 src/Main/globals.cxx        |  3 ---
 src/Main/globals.hxx        |  2 +-
 src/Main/main.cxx           | 12 ++++++++++--
 src/Scenery/tilemgr.cxx     | 12 +++++++++---
 src/Scenery/tilemgr.hxx     |  4 ++++
 utils/fgelev/fgelev.cxx     |  2 +-
 utils/fgviewer/fgviewer.cxx |  2 +-
 10 files changed, 60 insertions(+), 28 deletions(-)

diff --git a/src/GUI/MessageBox.cxx b/src/GUI/MessageBox.cxx
index 93563c6..d57d89e 100644
--- a/src/GUI/MessageBox.cxx
+++ b/src/GUI/MessageBox.cxx
@@ -37,6 +37,10 @@ namespace {
 
 bool isCanvasImplementationRegistered()
 {
+	if (!globals) {
+		return false;
+	}
+
     SGCommandMgr* cmd = globals->get_commands();
     return (cmd->getCommand("canvas-message-box") != NULL);
 }
@@ -46,7 +50,7 @@ bool isCanvasImplementationRegistered()
 HWND getMainViewerHWND()
 {
 	osgViewer::Viewer::Windows windows;
-	if (!globals->get_renderer() || !globals->get_renderer()->getViewer()) {
+	if (!globals || !globals->get_renderer() || !globals->get_renderer()->getViewer()) {
 		return 0;
 	}
 
diff --git a/src/Main/bootstrap.cxx b/src/Main/bootstrap.cxx
index da45058..326401a 100644
--- a/src/Main/bootstrap.cxx
+++ b/src/Main/bootstrap.cxx
@@ -73,6 +73,9 @@ using std::endl;
 
 #if defined(HAVE_CRASHRPT)
 	#include <CrashRpt.h>
+
+bool global_crashRptEnabled = false;
+
 #endif
 
 std::string homedir;
@@ -210,8 +213,14 @@ int main ( int argc, char **argv )
 	// Install crash reporting
 	int nResult = crInstall(&info);    
 	if(nResult!=0) {
-		std::cerr << "failed to install crash reporting engine" << std::endl;
+		char buf[1024];
+		crGetLastErrorMsg(buf, 1024);
+		flightgear::modalMessageBox("CrashRpt setup failed", 
+			"Failed to setup crash-reporting engine, check the installation is not damaged.",
+			buf);
 	} else {
+		global_crashRptEnabled = true;
+
 		crAddProperty("hudson-build-id", HUDSON_BUILD_ID);
 		char buf[16];
 		::snprintf(buf, 16, "%d", HUDSON_BUILD_NUMBER);
diff --git a/src/Main/fg_commands.cxx b/src/Main/fg_commands.cxx
index 4c0f580..efbb4a9 100644
--- a/src/Main/fg_commands.cxx
+++ b/src/Main/fg_commands.cxx
@@ -31,6 +31,7 @@
 #include <GUI/dialog.hxx>
 #include <Aircraft/replay.hxx>
 #include <Scenery/scenery.hxx>
+#include <Scenery/tilemgr.hxx>
 #include <Scripting/NasalSys.hxx>
 #include <Sound/sample_queue.hxx>
 #include <Airports/xmlloader.hxx>
@@ -500,26 +501,29 @@ do_tile_cache_reload (const SGPropertyNode * arg)
 /**
  * Reload the materials definition
  */
- static bool
- do_materials_reload (const SGPropertyNode * arg)
- {
-   SG_LOG(SG_INPUT, SG_INFO, "Reloading Materials");
-   SGMaterialLib* new_matlib =  new SGMaterialLib;
-   SGPath mpath( globals->get_fg_root() );
-   mpath.append( fgGetString("/sim/rendering/materials-file") );
-   bool loaded = new_matlib->load(globals->get_fg_root(), 
+static bool
+do_materials_reload (const SGPropertyNode * arg)
+{
+    SG_LOG(SG_INPUT, SG_INFO, "Reloading Materials");
+    SGMaterialLib* new_matlib =  new SGMaterialLib;
+    SGPath mpath( globals->get_fg_root() );
+    mpath.append( fgGetString("/sim/rendering/materials-file") );
+    bool loaded = new_matlib->load(globals->get_fg_root(), 
                                   mpath.str(), 
                                   globals->get_props());
-   
-   if ( ! loaded ) {
+
+    if ( ! loaded ) {
        SG_LOG( SG_GENERAL, SG_ALERT,
                "Error loading materials file " << mpath.str() );
        return false;
-   }  
-   
-   globals->set_matlib(new_matlib);    
-   return true;   
- }
+    }  
+
+    globals->set_matlib(new_matlib);    
+    FGTileMgr* tileManager = static_cast<FGTileMgr*>(globals->get_subsystem("tile-manager"));
+    tileManager->materialLibChanged();
+    
+    return true;
+}
 
 
 #if 0
diff --git a/src/Main/globals.cxx b/src/Main/globals.cxx
index d0a3d10..e21e5b5 100644
--- a/src/Main/globals.cxx
+++ b/src/Main/globals.cxx
@@ -145,7 +145,6 @@ FGGlobals::FGGlobals() :
     fg_home( "" ),
     time_params( NULL ),
     ephem( NULL ),
-    matlib( NULL ),
     route_mgr( NULL ),
     ATIS_mgr( NULL ),
     controls( NULL ),
@@ -764,8 +763,6 @@ void FGGlobals::set_tile_mgr ( FGTileMgr *t )
 
 void FGGlobals::set_matlib( SGMaterialLib *m )
 {
-    if (matlib)
-        delete matlib;
     matlib = m;
 }
 
diff --git a/src/Main/globals.hxx b/src/Main/globals.hxx
index 8f1736f..d360908 100644
--- a/src/Main/globals.hxx
+++ b/src/Main/globals.hxx
@@ -114,7 +114,7 @@ private:
     SGEphemeris *ephem;
 
     // Material properties library
-    SGMaterialLib *matlib;
+    SGSharedPtr<SGMaterialLib> matlib;
 
     // Global autopilot "route"
     FGRouteMgr *route_mgr;
diff --git a/src/Main/main.cxx b/src/Main/main.cxx
index 2d3c648..c146a14 100644
--- a/src/Main/main.cxx
+++ b/src/Main/main.cxx
@@ -35,6 +35,10 @@
 
 #if defined(HAVE_CRASHRPT)
 	#include <CrashRpt.h>
+
+// defined in bootstrap.cxx
+extern bool global_crashRptEnabled;
+
 #endif
 
 // Class references
@@ -346,8 +350,12 @@ static void logToFile()
     sglog().logToFile(logPath, SG_ALL, SG_INFO);
 
 #if defined(HAVE_CRASHRPT)
-	crAddFile2(logPath.c_str(), NULL, "FlightGear Log File", CR_AF_MAKE_FILE_COPY);
-	SG_LOG( SG_GENERAL, SG_INFO, "CrashRpt enabled");
+	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
 }
 
diff --git a/src/Scenery/tilemgr.cxx b/src/Scenery/tilemgr.cxx
index 3df77c0..ce3fd77 100644
--- a/src/Scenery/tilemgr.cxx
+++ b/src/Scenery/tilemgr.cxx
@@ -86,7 +86,8 @@ void FGTileMgr::init() {
     SG_LOG( SG_TERRAIN, SG_INFO, "Initializing Tile Manager subsystem." );
 
     _options = new simgear::SGReaderWriterOptions;
-    _options->setMaterialLib(globals->get_matlib());
+    
+    materialLibChanged();
     _options->setPropertyNode(globals->get_props());
 
     osgDB::FilePathList &fp = _options->getDatabasePathList();
@@ -116,8 +117,7 @@ void FGTileMgr::reinit()
     fgSetBool("/sim/sceneryloaded",false);
     fgSetDouble("/sim/startup/splash-alpha", 1.0);
     
-    // Reload the materials definitions
-    _options->setMaterialLib(globals->get_matlib());
+    materialLibChanged();
 
     // remove all old scenery nodes from scenegraph and clear cache
     osg::Group* group = globals->get_scenery()->get_terrain_branch();
@@ -141,6 +141,12 @@ void FGTileMgr::reinit()
     update(0.0);
 }
 
+void FGTileMgr::materialLibChanged()
+{
+    _options->setMaterialLib(globals->get_matlib());
+    _options->getMaterialLib()->refreshActiveMaterials();
+}
+
 /* schedule a tile for loading, keep request for given amount of time.
  * Returns true if tile is already loaded. */
 bool FGTileMgr::sched_tile( const SGBucket& b, double priority, bool current_view, double duration)
diff --git a/src/Scenery/tilemgr.hxx b/src/Scenery/tilemgr.hxx
index 2c676f7..323f7d8 100644
--- a/src/Scenery/tilemgr.hxx
+++ b/src/Scenery/tilemgr.hxx
@@ -110,6 +110,10 @@ public:
 
     // Returns true if tiles around current view position have been loaded
     bool isSceneryLoaded();
+    
+    // notify the tile manahger the material library was reloaded,
+    // so it can pass this through to its options object
+    void materialLibChanged();
 };
 
 
diff --git a/utils/fgelev/fgelev.cxx b/utils/fgelev/fgelev.cxx
index 90d7eb4..3ad0b58 100644
--- a/utils/fgelev/fgelev.cxx
+++ b/utils/fgelev/fgelev.cxx
@@ -132,7 +132,7 @@ main(int argc, char** argv)
     simgear::ModelRegistry::instance();
 
     sgUserDataInit(props.get());
-    SGMaterialLib* ml = new SGMaterialLib;
+    SGMaterialLibPtr ml = new SGMaterialLib;
     SGPath mpath(fg_root);
     mpath.append("Materials/default/materials.xml");
     try {
diff --git a/utils/fgviewer/fgviewer.cxx b/utils/fgviewer/fgviewer.cxx
index f8cbdac..f5bb8e9 100644
--- a/utils/fgviewer/fgviewer.cxx
+++ b/utils/fgviewer/fgviewer.cxx
@@ -179,7 +179,7 @@ main(int argc, char** argv)
     // FIXME Ok, replace this by querying the root of the property tree
     sgUserDataInit(props.get());
     SGSceneFeatures::instance()->setTextureCompression(SGSceneFeatures::DoNotUseCompression);
-    SGMaterialLib* ml = new SGMaterialLib;
+    SGMaterialLibPtr ml = new SGMaterialLib;
     SGPath mpath(fg_root);
     mpath.append("Materials/default/materials.xml");
     try {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/collab-maint/flightgear.git



More information about the pkg-fgfs-crew mailing list