]> git.mxchange.org Git - flightgear.git/commitdiff
Patch from Julian Foad:
authordavid <david>
Sat, 7 Sep 2002 12:35:31 +0000 (12:35 +0000)
committerdavid <david>
Sat, 7 Sep 2002 12:35:31 +0000 (12:35 +0000)
     Use getDisplayName instead of duplicated code: gives a better
decision on whether to display the index.
     Replace unnecessary node lookups by name with direct access: tidier
and more efficient.  E.g. "getValueTypeString
(node->getNode(name.c_str()))" -> "getValueTypeString (child)".

src/Network/props.cxx

index 8752da41b927eb48ec5d9c2cd96ec6813d22443f..8dd3331ef96fd1c603298f0d7f4f1c80a178d237 100644 (file)
@@ -203,15 +203,7 @@ PropsChannel::foundTerminator()
            for (int i = 0; i < dir->nChildren(); i++)
            {
                SGPropertyNode * child = dir->getChild(i);
-               string name = child->getName();
-               string line = name;
-
-               if (dir->getChild( name.c_str(), 1 ))
-               {
-                   char buf[16];
-                   sprintf(buf, "[%d]", child->getIndex());
-                   line += buf;
-               }
+               string line = child->getDisplayName(true);
 
                if ( child->nChildren() > 0 )
                {
@@ -221,10 +213,9 @@ PropsChannel::foundTerminator()
                {
                    if (mode == PROMPT)
                    {
-                       string value = dir->getStringValue( name.c_str(), "" );
+                       string value = child->getStringValue();
                        line += " =\t'" + value + "'\t(";
-                       line += getValueTypeString(
-                                       dir->getNode( name.c_str() ) );
+                       line += getValueTypeString( child );
                        line += ")";
                    }
                }