]> git.mxchange.org Git - simgear.git/blobdiff - simgear/props/props_io.cxx
Harald JOHNSEN:
[simgear.git] / simgear / props / props_io.cxx
index ec549011865a9ffa7840c74c85e30fa5276958a8..a4fe5a16e4b62c54f17440dec2b8877a1ddf66ac 100644 (file)
@@ -214,7 +214,10 @@ PropsVisitor::startElement (const char * name, const XMLAttributes &atts)
       }
     }
 
-    push_state(node, atts.getValue("type"), mode);
+    const char *type = atts.getValue("type");
+    if (type)
+      node->clearValue();
+    push_state(node, type, mode);
   }
 }
 
@@ -368,7 +371,6 @@ getTypeName (SGPropertyNode::Type type)
   case SGPropertyNode::STRING:
     return "string";
   case SGPropertyNode::ALIAS:
-    return "alias";
   case SGPropertyNode::NONE:
     return "unspecified";
   }
@@ -551,7 +553,7 @@ copyProperties (const SGPropertyNode *in, SGPropertyNode *out)
                                // First, copy the actual value,
                                // if any.
   if (in->hasValue()) {
-    switch (in->getType(false)) {
+    switch (in->getType()) {
     case SGPropertyNode::BOOL:
       if (!out->setBoolValue(in->getBoolValue()))
        retval = false;
@@ -580,19 +582,18 @@ copyProperties (const SGPropertyNode *in, SGPropertyNode *out)
       if (!out->setUnspecifiedValue(in->getStringValue()))
        retval = false;
       break;
-    case SGPropertyNode::ALIAS: {
-      const char *path = in->getAliasTarget()->getPath();
-      SGPropertyNode *node = out->getRootNode()->getNode(path, true);
-      out->alias(node);
-      break;
-    }
     default:
+      if (in->isAlias())
+       break;
       string message = "Unknown internal SGPropertyNode type";
       message += in->getType();
       throw sg_error(message, "SimGear Property Reader");
     }
   }
 
+                               // copy the attributes.
+  out->setAttributes( in->getAttributes() );
+
                                // Next, copy the children.
   int nChildren = in->nChildren();
   for (int i = 0; i < nChildren; i++) {