Melchior FRANZ:

My recent fix for the load/save fgfs.sav feature was a bit too ambitious.
While aliases lead to abortion before, I tried to copy them properly,
although this wasn't a requirement. Unfortunately, this seems to have
worked for absolute aliases only, not for relative ones, and hence broke
several panel instruments. The attached patch backs most of the previous
patch out again, and goes a simpler route: just ignore aliases.
This commit is contained in:
ehofman 2004-12-23 13:32:01 +00:00
parent 37ac409586
commit d88fb32a73
3 changed files with 6 additions and 13 deletions

View File

@ -969,9 +969,9 @@ SGPropertyNode::getPath (bool simplify) const
} }
SGPropertyNode::Type SGPropertyNode::Type
SGPropertyNode::getType (bool deref_alias) const SGPropertyNode::getType () const
{ {
if (_type == ALIAS && deref_alias) if (_type == ALIAS)
return _value.alias->getType(); return _value.alias->getType();
else else
return _type; return _type;

View File

@ -850,10 +850,8 @@ public:
/** /**
* Get the type of leaf value, if any, for this node. * Get the type of leaf value, if any, for this node.
* When applied to an ALIAS node, deref_alias decides if the type
* of the referred node is to be returned (default), or ALIAS.
*/ */
Type getType (bool deref_alias = true) const; Type getType () const;
/** /**

View File

@ -368,7 +368,6 @@ getTypeName (SGPropertyNode::Type type)
case SGPropertyNode::STRING: case SGPropertyNode::STRING:
return "string"; return "string";
case SGPropertyNode::ALIAS: case SGPropertyNode::ALIAS:
return "alias";
case SGPropertyNode::NONE: case SGPropertyNode::NONE:
return "unspecified"; return "unspecified";
} }
@ -551,7 +550,7 @@ copyProperties (const SGPropertyNode *in, SGPropertyNode *out)
// First, copy the actual value, // First, copy the actual value,
// if any. // if any.
if (in->hasValue()) { if (in->hasValue()) {
switch (in->getType(false)) { switch (in->getType()) {
case SGPropertyNode::BOOL: case SGPropertyNode::BOOL:
if (!out->setBoolValue(in->getBoolValue())) if (!out->setBoolValue(in->getBoolValue()))
retval = false; retval = false;
@ -580,13 +579,9 @@ copyProperties (const SGPropertyNode *in, SGPropertyNode *out)
if (!out->setUnspecifiedValue(in->getStringValue())) if (!out->setUnspecifiedValue(in->getStringValue()))
retval = false; retval = false;
break; break;
case SGPropertyNode::ALIAS: {
const char *path = in->getAliasTarget()->getPath();
SGPropertyNode *node = out->getRootNode()->getNode(path, true);
out->alias(node);
break;
}
default: default:
if (in->isAlias())
break;
string message = "Unknown internal SGPropertyNode type"; string message = "Unknown internal SGPropertyNode type";
message += in->getType(); message += in->getType();
throw sg_error(message, "SimGear Property Reader"); throw sg_error(message, "SimGear Property Reader");