]> git.mxchange.org Git - flightgear.git/commitdiff
Patch from Julian Foad:
authordavid <david>
Wed, 31 Jul 2002 16:45:35 +0000 (16:45 +0000)
committerdavid <david>
Wed, 31 Jul 2002 16:45:35 +0000 (16:45 +0000)
Use getDisplayName instead of duplicated code.
Replace unnecessary node lookups by name with direct access.

src/Network/httpd.cxx
src/Network/telnet.cxx

index 97ab9b5d4b768d158a644110a0ca96d6206362df..1c01ac7eb6f7a042c8a5fb1cd5a289903370472f 100644 (file)
@@ -178,12 +178,7 @@ void HttpdChannel::foundTerminator (void) {
 
             for (int i = 0; i < node->nChildren(); i++) {
                 SGPropertyNode *child = node->getChild(i);
-                string name = child->getName();
-                if ( node->getChild(name.c_str(), 1) ) {
-                    char buf[16];
-                    sprintf(buf, "[%d]", child->getIndex());
-                    name += buf;
-                }
+                string name = child->getDisplayName(true);
                 string line = "";
                 if ( child->nChildren() > 0 ) {
                     line += "<B><A HREF=\"";
index d0c23d6770f35a6034c66f5b25ff4d48ac725ac6..158a659008ad4cb448148927c39be71fa1312d92 100644 (file)
@@ -201,15 +201,7 @@ TelnetChannel::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 )
                {
@@ -219,10 +211,9 @@ TelnetChannel::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 += ")";
                    }
                }