]> git.mxchange.org Git - flightgear.git/blobdiff - src/Model/modelmgr.cxx
Merge branch 'next' into comm-subsystem
[flightgear.git] / src / Model / modelmgr.cxx
index 2b547cf027486a0cfcefbad6f69f98329ada551c..139cf2d4f2441eb00e5c7fff7a1694d5c0abd32c 100644 (file)
@@ -3,6 +3,10 @@
 //
 // This file is in the Public Domain, and comes with no warranty.
 
+#ifdef _MSC_VER
+#  pragma warning( disable: 4355 )
+#endif
+
 #ifdef HAVE_CONFIG_H
 #  include <config.h>
 #endif
@@ -12,6 +16,7 @@
 #include <algorithm>
 #include <functional>
 #include <vector>
+#include <cstring>
 
 #include <osg/Math>
 
@@ -65,21 +70,22 @@ FGModelMgr::add_model (SGPropertyNode * node)
 {
   SG_LOG(SG_GENERAL, SG_INFO,
          "Adding model " << node->getStringValue("name", "[unnamed]"));
-  Instance * instance = new Instance;
-  SGModelPlacement *model = new SGModelPlacement;
-  instance->model = model;
-  instance->node = node;
 
   const char *path = node->getStringValue("path", "Models/Geometry/glider.ac");
   osg::Node *object;
 
   try {
-    object = SGModelLib::loadPagedModel(path, globals->get_props());
+      object = SGModelLib::loadDeferredModel(path, globals->get_props());
   } catch (const sg_throwable& t) {
     SG_LOG(SG_GENERAL, SG_ALERT, "Error loading " << path << ":\n  "
         << t.getFormattedMessage() << t.getOrigin());
     return;
   }
+  
+  Instance * instance = new Instance;
+  SGModelPlacement *model = new SGModelPlacement;
+  instance->model = model;
+  instance->node = node;
 
   model->init( object );
 
@@ -172,7 +178,7 @@ struct UpdateFunctor : public std::unary_function<FGModelMgr::Instance*, void>
                 pitch = testNan(instance->pitch_deg_node->getDoubleValue());
             if (instance->heading_deg_node != 0)
                 heading = testNan(instance->heading_deg_node->getDoubleValue());
-        } catch (const sg_range_exception& e) {
+        } catch (const sg_range_exception&) {
             const char *path = instance->node->getStringValue("path",
                                                               "unknown");
             SG_LOG(SG_GENERAL, SG_INFO, "Instance of model " << path