]> git.mxchange.org Git - flightgear.git/commitdiff
Model-loading patch from Dave Luff.
authordavid <david>
Wed, 20 Mar 2002 22:40:11 +0000 (22:40 +0000)
committerdavid <david>
Wed, 20 Mar 2002 22:40:11 +0000 (22:40 +0000)
src/Main/model.cxx

index d4d8b9975b7155492ddd21fa068254460e81424f..771a4f87dc26f780b23f6142d3150a2ce2e1d69f 100644 (file)
@@ -69,22 +69,24 @@ FGAircraftModel::init ()
   SG_LOG(SG_INPUT, SG_INFO, "Initializing aircraft 3D model");
 
                                // Load the 3D aircraft object itself
-  SGPath path = globals->get_fg_root();
-  path.append(fgGetString("/sim/model/path", "Models/Geometry/glider.ac"));
-
-  if (path.str().substr(path.str().size() - 4, 4) == ".xml") {
-    readProperties(path.str(), &props);
+  // DCL - the xml parser requires the full path but the ssgLoader doesn't
+  // so lets have two paths.
+  SGPath xmlpath = globals->get_fg_root();
+  SGPath modelpath = (string)fgGetString("/sim/model/path", "Models/Geometry/glider.ac");
+  xmlpath.append(modelpath.str());
+
+  if (xmlpath.str().substr(xmlpath.str().size() - 4, 4) == ".xml") {
+    readProperties(xmlpath.str(), &props);
     if (props.hasValue("/path")) {
-      path = path.dir();;
-      path.append(props.getStringValue("/path"));
+      modelpath = modelpath.dir();
+      modelpath.append(props.getStringValue("/path"));
     } else {
-      path = globals->get_fg_root();
-      path.append("Models/Geometry/glider.ac");
+      modelpath = "Models/Geometry/glider.ac";
     }
   }
 
-  ssgTexturePath((char *)path.dir().c_str());
-  _model = ssgLoad((char *)path.c_str());
+  ssgTexturePath((char *)xmlpath.dir().c_str());
+  _model = ssgLoad((char *)modelpath.c_str());
   if (_model == 0) {
     _model = ssgLoad((char *)"Models/Geometry/glider.ac");
     if (_model == 0)
@@ -381,7 +383,3 @@ FGAircraftModel::Animation::setRotation()
 
 
 // end of model.cxx
-
-
-
-