]> git.mxchange.org Git - flightgear.git/blobdiff - src/Objects/matlib.cxx
Updates to the electrical system model. "Juice" is now propogated through
[flightgear.git] / src / Objects / matlib.cxx
index 15a045fb800707340ee7ac6bf846dc5fa651dbe3..e80bd149232e4589ac4799226fc3d00ce0a45826 100644 (file)
 #include <Main/fg_props.hxx>
 #include <Scenery/tileentry.hxx>
 
+#include "newmat.hxx"
 #include "matlib.hxx"
 
+SG_USING_NAMESPACE(std);
 SG_USING_STD(string);
 
 
@@ -71,7 +73,7 @@ bool FGMaterialLib::load( const string& mpath ) {
 
   SGPropertyNode materials;
 
-  cout << "Reading materials from " << mpath << endl;
+  SG_LOG(SG_INPUT, SG_INFO, "Reading materials from " << mpath);
   try {
     readProperties(mpath, &materials);
   } catch (const sg_exception &ex) {
@@ -82,13 +84,15 @@ bool FGMaterialLib::load( const string& mpath ) {
   int nMaterials = materials.nChildren();
   for (int i = 0; i < nMaterials; i++) {
     const SGPropertyNode * node = materials.getChild(i);
-    if (node->getName() == "material") {
+    if (!strcmp(node->getName(), "material")) {
       FGNewMat * m = new FGNewMat(node);
 
-      vector<const SGPropertyNode *>names = node->getChildren("name");
+      vector<SGPropertyNode_ptr>names = node->getChildren("name");
       for (unsigned int j = 0; j < names.size(); j++) {
+       string name = names[j]->getStringValue();
        m->ref();
-       matlib[names[j]->getStringValue()] = m;
+       // cerr << "Material " << name << endl;
+       matlib[name] = m;
        SG_LOG( SG_TERRAIN, SG_INFO, "  Loading material "
                << names[j]->getStringValue());
       }
@@ -218,5 +222,3 @@ void FGMaterialLib::load_next_deferred() {
          return;
     }
 }
-
-